1.参考
https://blog.youkuaiyun.com/fhf2424045058/article/details/106499283
2.Nginx下载
1)Nginx
http://nginx.org/en/download.html (版本:nginx-1.16.1 tar.gz)
2)Pcre
https://sourceforge.net/projects/pcre/files/pcre/8.41/(版本:pcre-8.41.tar.gz)
3)Zlib
http://www.zlib.net/(版本:zlib-1.2.11.tar.gz)
4)Oppenssl
https://www.openssl.org/source/(版本:openssl-1.1.1g.tar.gz)
3.Nginx安装
1)解压
1.tar -xzvf nginx-1.16.1 tar.gz
2.tar -xzvf pcre-8.41.tar.gz
3.tar -xzvf zlib-1.2.11.tar.gz
4.tar -xzvf openssl-1.1.1g.tar.gz
2)安装
1.进入nginx目录:cd nginx-1.16.1
2.创建安装目录:mkdir installs
3.编译nginx
./configure --prefix=/usr/local/nginx/
./configure --prefix=/usr/local/nginx/ --with-stream //--with-stream 转发服务
./configure --prefix=/home/ZDHQX/Nginx/nginx-1.16.1/installs –-with-pcre=../pcre-8.41 --with-openssl=../openssl-1.1.1g --with-zlib=../zlib-1.2.11
4.安装nginx:make && make install
5.修改配置文件:
1)cd conf
2)vi nginx.conf
3)i编辑、esc退出、:wq保存
3)查看版本
1.cd installs/sbin
2.查看版本:./nginx -V
3.检测:./nginx -t
4)启动与停止
1.启动:./nginx
2.停止:./nginx -s stop
3.重启:./nginx -s reload
4.指定conf文件检测与启动
1)检测
./nginx -t -c path/conf/nginx.conf
2)启动
./nginx -c path/conf/nginx.conf