实验环境:linux_CentOS-7
1.安装Nginx运行环境:
yum install gcc-c++
yum install -y pcre pcre-devel
yum install -y zlib zlib-devel
yum install -y openssl openssl-devel
注:
gcc,编译依赖gcc环境,如果没有gcc环境的话,需要安装gcc。
pcre,编译依赖。
zlib, http内容压缩需要。
openssl,https(ssl协议所需要。
2.安装Nginx
首先打开网站 “http://nginx.org/en/download.html“ ,下载最新linux版的nginx安装包“nginx-1.16.1”。

下载安装包,放到/home目录下:

解压:

进入解压目录,编译安装:
[root@hejie home]# cd nginx-1.16.1
[root@hejie nginx-1.16.1]# ./configure –prefix=/usr/local/nginx
报错:./configure: line 10: auto/options: No such file or directory (查看auto目录不完整,说明下载安装包有问题,重新下载),重新执行编译,正常。

[root@hejie home]# make
[root@hejie home]# make install
编译安装完成。
3.启动nginx
cd进入 "/usr/local/nginx/sbin/"
执行"./nginx",无错误提示 ,启动成功:

4.访问测试

记得开放 80端口。
未经允许不得转载:天府数据港官方信息博客 » Nginx 安装与配置
客官点个赞呗! (0)