CentOS7安装nginx-1.17.6
Centos7安装nginx-1.17.6
安装pcre-8.43.tar.gz,PCRE - 支持正则表达式,NGINX Core和Rewrite模块需要。
http://www.pcre.org/
ftp://ftp.pcre.org/pub/pcre/pcre-8.43.tar.gz
cd /opt/
上传文件
rz
tar -zxvf pcre-8.43.tar.gz
cd pcre-8.43/
配置检查,生成 makefile 文件
./configure
make && make install
查看版本
pcre-config --version
安装zlib - 支持标头压缩。NGINX Gzip模块需要。
http://zlib.net/zlib-1.2.11.tar.gz
cd /opt/
上传文件
rz
tar -zxvf zlib-1.2.11.tar.gz
cd zlib-1.2.11/
./configure
make && make install
安装OpenSSL - 支持HTTPS协议。NGINX SSL模块和其他人员要求。
https://www.openssl.org/source/openssl-1.0.2t.tar.gz
cd /opt/
上传文件
rz
tar -zxvf openssl-1.1.1d.tar.gz
cd openssl-1.1.1d/
./config
make && make install
下载安装Nginx
http://nginx.org/download/nginx-1.17.6.tar.gz
cd /opt/
上传文件
rz
tar -zxvf nginx-1.17.6.tar.gz
mv nginx-1.17.6/ /usr/local/nginx
./configure --prefix=/usr/local/nginx --conf-path=/usr/local/nginx/nginx.conf
make && make install
安装成功后在/usr/local/ 文件夹下会有个nginx目录
启动
cd /usr/local/nginx/sbin
./nginx
ps -ef |grep nginx
查看nginx端口号
ss -lnput|grep nginx
启动nginx
/usr/local/nginx-1.17.1/sbin/nginx
停掉nginx:
/usr/local/nginx1.17.1/sbin/nginx -s stop
重启nginx:
/usr/local/nginx1.17.1/sbin/nginx -s reload