環(huán)境:CentOS Linux release 7.5.1804 (Core)
安裝步驟
1.安裝編譯環(huán)境和依賴庫
yum -y install gcc gcc-c++ autoconf automake
yum -y install zlib zlib-devel openssl openssl-devel pcre pcre-devel
2.下載nginx安裝包
wget http://nginx.org/download/nginx-1.14.0.tar.gz
3.編譯安裝,默認安裝路徑(/usr/local/nginx)
tar zxvf nginx-1.14.0.tar.gz
./configure
cd nginx-1.14.0
./configure
make
sudo make install
基本命令
./nginx #啟動nginx
./nginx -v #查看版本
./nginx -s reload #重新加載配置文件
./nginx -t #檢查配置文件
./nginx -s stop #停止
防火墻開啟http(centos7默認防火墻禁用http)
[root@localhost sbin]# firewall-cmd --zone=public --permanent --add-service=http
success
[root@localhost sbin]# firewall-cmd --reload
success