一、源碼包安裝以前,首頁安裝依賴包nginx
yum -y install gcc gcc-c++ make libtool zlib zlib-devel openssl openssl-devel pcre pcre-devel
二、去nginx官網去下載穩定版安裝包c++
wget http://nginx.org/download/nginx-1.14.2.tar.gz
三、解壓縮vim
tar -zxvf nginx-1.14.2.tar.gz
三、編譯安裝服務器
cd nginx-1.14.2 ./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-pcre make && make install
四、nginx相關命令code
/usr/local/nginx/sbin/nginx # 啓動 /usr/local/nginx/sbin/nginx -s stop #中止 /usr/local/nginx/sbin/nginx -s reload #從新加載配置
五、將nginx加入環境變量ip
vim /etc/profile export NGINX_HOME=/usr/local/nginx export PATH=$PATH:$NGINX_HOME/sbin
六、檢測nginx安裝ssl
nginx -v # 命令檢測 http://服務器ip # 網頁檢測
網頁檢測可能失敗,由於防火牆get
七、關閉防火牆源碼
systemctl start firewalld #啓動 systemctl stop firewalld #關閉 systemctl status firewalld #查看狀態 systemctl disable firewalld # 開機禁用 systemctl enable firewalld #開機啓用