1. 程式人生 > >centos7.2 nginx-1.13.7安裝

centos7.2 nginx-1.13.7安裝

centos7 nginx-1.13.7安裝

1、直接下載.tar.gz安裝包,地址:https://nginx.org/en/download.html, 下載nginx-1.13.7.tar.gz

    使用wget命令下載  

            wget -c http://nginx.org/download/nginx-1.13.7.tar.gz

2. 解壓  tar -zxvf nginx-1.13.7.tar.gz

3. 進入解壓後的目錄 cd nginx-1.13.7

4.安裝 ./configure

  或者  ./configure --prefix=/usr/local/nginx

 make

 make install

5. 開放80埠

firewall-cmd --state

    not running

service firewalld restart

     Redirecting to /bin/systemctl restart  firewalld.service

firewall-cmd --zone=public--add-port=80/tcp --permanent

     success

firewall-cmd --permanent--list-port

      80/tcp 

service firewalld restart

                Redirecting to /bin/systemctl restart  firewalld.service

systemctl stopfirewalld.service

6. 啟動,關閉nginx

檢視安裝位置:whereis nginx

nginx: /usr/lib64/nginx /etc/nginx /usr/local/nginx /usr/share/nginx

cd /usr/local/nginx/sbin/

啟動: ./nginx  

檢視啟動: ps -ef|grep nginx  

停止:./nginx -s stop

修改 nginx/conf/nginx.conf 檔案

重啟:./nginx -s reload

7. 安裝過程中,有可能需要安裝依賴項:

   yum install -y pcre pcre-devel    yum install -y zlib zlib-devel

   yum install -y openssl openssl-devel