centos 7 源碼包安裝、卸載nginx


1、源碼包安裝之前,首頁安裝依賴包

yum -y install gcc gcc-c++ make libtool zlib zlib-devel openssl openssl-devel pcre pcre-devel

2、去nginx官網去下載穩定版安裝包

wget http://nginx.org/download/nginx-1.14.2.tar.gz

3、解壓縮

tar -zxvf nginx-1.14.2.tar.gz

3、編譯安裝

cd nginx-1.14.2

./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-pcre

make && make install

4、nginx相關命令

/usr/local/nginx/sbin/nginx # 啟動

/usr/local/nginx/sbin/nginx -s stop #停止

/usr/local/nginx/sbin/nginx -s reload #重新加載配置

5、將nginx加入環境變量

vim /etc/profile

export NGINX_HOME=/usr/local/nginx

export PATH=$PATH:$NGINX_HOME/sbin

6、檢測nginx安裝

nginx -v # 命令檢測

http://服務器ip # 網頁檢測

網頁檢測可能失敗,因為防火牆

7、關閉防火牆

systemctl start firewalld #啟動

systemctl stop firewalld #關閉

systemctl status firewalld  #查看狀態

systemctl disable firewalld # 開機禁用 

systemctl enable firewalld #開機啟用


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM