CENTOS7安装NGINX
1)安装所需环境
yum install gcc-c++
yum install -y pcre pcre-devel
yum install -y zlib zlib-devel
yum install -y openssl openssl-devel
2)官网下载NGINX
浏览器打开:https://nginx.org/en/download.html
查看最新的稳定版本号
wget -c https://nginx.org/download/nginx-1.16.1.tar.gz
解压 :
tar -zxvf nginx-1.16.1.tar.gz
cd nginx-1.16.1
3)编译安装
./configure
make
make install
4)NIGNX启动、停止命令
cd /usr/local/nginx/sbin/
./nginx
./nginx -s stop
./nginx -s quit
./nginx -s reload
5)检查是否成功
6)设置开机自启动
vi /etc/rc.local
增加一行 /usr/local/nginx/sbin/nginx
设置执行权限:
chmod 755 /etc/rc.local