Centos7通過yum 安裝Nginx

第一步:安裝EPEL存儲庫:

[root@localhost nginx-rtmp-module-1.1.11]# yum install epel-release

第二步:安裝nginx:

[root@localhost nginx-rtmp-module-1.1.11]#  yum install nginx

如果這是您第一次從EPEL存儲庫安裝包裝,yum可能會提示您導入EPEL GPG密鑰:

從 file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 檢索密鑰
導入 GPG key 0x352C64E5:
 用戶ID     : "Fedora EPEL (7) <[email protected]>"
 指紋       : 91e9 7d7c 4a5e 96f1 7f3e 888f 6a2f aea2 352c 64e5
 軟件包     : epel-release-7-11.noarch (@extras)
 來自       : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
是否繼續?[y/N]:y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction

第三步:nginx 開機自啓動和nginx 服務啓動和狀態查看

[root@localhost nginx-rtmp-module-1.1.11]# systemctl enable nginx  #開機自啓動
Created symlink from /etc/systemd/system/multi-user.target.wants/nginx.service to /usr/lib/systemd/system/nginx.service.
[root@localhost nginx-rtmp-module-1.1.11]# systemctl start nginx   #啓動nginx服務
[root@localhost nginx-rtmp-module-1.1.11]# systemctl status  nginx  #查看nginx 狀態

第四步:防火牆開放指定服務http 和http

root@localhost nginx-rtmp-module-1.1.11]# firewall-cmd --permanent --zone=public --add-service=http   #開啓http
success
[root@localhost nginx-rtmp-module-1.1.11]# firewall-cmd --permanent --zone=public --add-service=https  #開啓https
success
[root@localhost nginx-rtmp-module-1.1.11]#  firewall-cmd --reload   #防火牆重啓

Systemctl 管理nginx 涉及其他指令:

停止Nginx服務=systemctl stop nginx
重新啓動Nginx服務=systemctl restart nginx
配置更改後重新加載Nginx服務= systemctl reload nginx
禁用Nginx服務在啓動時啓動 =systemctl disable nginx
Nginx服務開機自啓動= systemctl enable nginx

Nginx 使用yum 安裝nginx 相關目錄說明:

(1) Nginx配置路徑:/etc/nginx/ 
(2) PID目錄:/var/run/nginx.pid 
(3) 錯誤日誌:/var/log/nginx/error.log 
(4) 訪問日誌:/var/log/nginx/access.log 
(5) 默認站點目錄:/usr/share/nginx/html

(6) Nginx腳本指令路徑:/usr/sbin/nginx

(7)Nginx 安裝的模塊:/usr/lib64/nginx


 

查詢nginx 默認目錄:

[root@localhost conf.d]# whereis nginx
nginx: /usr/sbin/nginx /usr/lib64/nginx /etc/nginx /usr/share/nginx /usr/share/man/man8/nginx.8.gz /usr/share/man/man3/nginx.3pm.gz

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章