linux版本:CentOS Linux release 7.6.1810 (Core)
1.查询系统版本
lsb_release -a
2.在安装nginx前首先要确认系统中安装了gcc、pcre-devel、zlib-devel、openssl-devel。
如果没有手动下载依赖
3.下载最新版 nginx-1.9.9.tar.gz
nginx下载地址:https://nginx.org/download/
4.解压安装包
tar -zxvf nginx-1.9.9.tar.gz
5.进入nginx目录
cd nginx-1.9.9
6.执行脚本配置脚本 或者不执行 走默认配置
./configure --prefix=/usr/local/nginx
7.到nginx下的 找到/objs/Makefile的文件
去掉CFLAGS中里的-Werror
8.执行make、make install命令
make
make install
9.测试是否安装成功
cd /user/local/nginx/
./sbin/nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
10.启动nginx
cd /usr/local/nginx/sbin
./nginx
11.测试是否启动
[root@iZuf6gp1t778o5lk1u38n5Z sbin]# curl 127.0.0.1:80
Welcome to nginx!
If you see this page, the nginx web server is successfully installed and working. Further configuration is required.
For online documentation and support please refer to nginx.org.
Commercial support is available at nginx.com.
Thank you for using nginx.