linux安裝nginx步驟
yum -y install epel-release
yum -y install nginx
systemctl start nginx
systemctl enable nginx
- 通路是否成功,http://ip 即可,頁面是下面兩種,這其實是nginx的歡迎頁面(每個版本的nginx各不相同),這并不代表nginx沒有正常啟動,需要可以修改/usr/share/nginx/html目錄下的index.html,可修改成自己想要的頁面
nginx 安裝解除安裝
nginx 安裝解除安裝
linux解除安裝nginx步驟
systemctl stop nginx
chkconfig nginx off
yum remove nginx
rm -rf /usr/sbin/nginx
rm -rf /etc/nginx
rm -rf /etc/init.d/nginx
nginx的gz包安裝
yum -y install gcc gcc-c++ zlib zlib-devel openssl openssl-devel pcre pcre-devel
- 官網下載下傳安裝包,上傳至linux系統
- 解壓,zxvf顯示解壓檔案
tar zxf nginx-1.17.1.tar.gz
cd nginx-1.17.1
- 編譯,預設https沒有打開,需要添加 --with-http_ssl_module
./configure --with-http_ssl_module
make && make install
/usr/local/nginx/sbin/nginx
nginx的相關指令
啟 動: systemctl start nginx
關 閉: systemctl stop nginx
重 啟: systemctl restart nginx
重新加載: systemctl restart nginx
輔助指令
檢視防火牆狀态: firewall-cmd --state
更新防火牆規則: firewall-cmd --reload
關閉防火牆: systemctl stop firewalld.service
打開防火牆: systemctl start firewalld.service
永久開放80端口: firewall-cmd --zone=public --add-port=80/tcp --permanent