Nginx安装
1、安装openssl-1.1.1p.tar.gz
(1)进入存放openssl-1.1.1p.tar.gz文件目录:cd /home/
(2)解压安装文件:tar -zxvf openssl-1.1.1p.tar.gz
(3)进入openssl-1.1.1p目录:cd openssl-1.1.1p
(4)prefix配置安装路径:./config --prefix=/opt/openssl-1.1.1p
(5)编译:make
(6)安装:make install
2、安装zlib-1.2.8.tar.gz
(1)进入存放zlib-1.2.8.tar.gz文件目录:cd /home/
(2)解压安装文件:tar -zxvf zlib-1.2.8.tar.gz
(3)进入zlib-1.2.8目录:cd zlib-1.2.8
(4)prefix配置安装路径:./configure --prefix=/opt/zlib-1.2.8
(5)编译:make
(6)安装:make install
3、安装pcre-8.38.tar.gz
(1)进入存放pcre-8.38.tar.gz文件目录:cd /home/
(2)解压安装文件:tar -zxvf pcre-8.38.tar.gz
(3)进入pcre-8.38目录:cd pcre-8.38
(4)prefix配置安装路径:./configure --prefix=/opt/pcre-8.38
(5)编译:make
(6)安装:make install
4、安装nginx-1.8.0.tar.gz
(1)进入存放nginx-1.8.0.tar.gz文件目录:cd /home/
(2)解压安装文件:tar -zxvf nginx-1.8.0.tar.gz
(3)进入nginx-1.8.0目录:cd nginx-1.8.0
(4)with-pcre指定依赖包位置,prefix配置安装路径 :./configure --prefix=/opt/nginx/nginx_https --with-zlib=/opt/zlib-1.2.8 --with-http_stub_status_module --with-http_ssl_module --with-pcre=/opt/pcre-8.38 --with-openssl=/opt/openssl-1.1.1p
(5)编译:make
(6)安装:make install
5、至此Nginx完成安装
检测是否安装成功
(1)cd /opt/nginx-1.8.0/sbin
(2)./nginx -t
启动nginx
(1)cd /opt/nginx-1.8.0/sbin
(2)./nginx
重启nginx
(1)cd /opt/nginx-1.8.0/sbin
(2)./nginx -s reload
关闭nginx
(1)cd /opt/nginx-1.8.0/sbin
(2)./nginx -s stop
查看端口
netstat -ntlp
杀掉服务
pkill -9 nginx
查看nginx版本信息
nginx -v 或者nginx -V
修改配置文件
vim /opt/nginx-1.8.0/conf/nginx.conf