CentOS下,yum安裝nginx

一,準(zhǔn)備篇
1,配置網(wǎng)絡(luò)&關(guān)閉SELINUX&配置防火墻

配置網(wǎng)絡(luò)&關(guān)閉SELINUX&配置防火墻

2,創(chuàng)建www用戶
groupadd www && useradd -g www -s /bin/false www
二,安裝篇
1,添加nginx官方y(tǒng)um源
vi /etc/yum.repos.d/nginx.repo
CentOS 6
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/6/$basearch/
gpgcheck=1
enabled=1
CentOS 7
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/7/$basearch/
gpgcheck=1
enabled=1
2,下載nginx簽名密鑰
rpm --import http://nginx.org/keys/nginx_signing.key
3,yum安裝
yum -y install nginx
4,啟動(dòng)nginx
CentOS 6
service nginx start
CentOS 7
systemctl start nginx.service
systemctl enable nginx.service
5,狀態(tài)管理命令
CentOS 6
/etc/rc.d/init.d/nginx
service nginx start
service nginx stop
service nginx restart
service nginx condrestart
service nginx try-restart
service nginx force-reload
service nginx upgrade
service nginx reload
service nginx status
service nginx help
service nginx configtest
service nginx check-reload
chkconfig nginx on                       #啟用開機(jī)自啟
chkconfig nginx off                      #禁用開機(jī)自啟
CentOS 7
/usr/lib/systemd/system/nginx.service
systemctl start nginx.service
systemctl stop nginx.service
systemctl restart nginx.service
systemctl reload nginx.service
systemctl status nginx.service
systemctl enable nginx.service             #啟用開機(jī)自啟
systemctl disable nginx.service            #禁用開機(jī)自啟
6,相關(guān)軟件目錄及文件位置
/usr/sbin/nginx
/etc/nginx/nginx.conf
/var/lock/subsys/nginx
/var/run/nginx.pid
三,優(yōu)化篇

暫無

參考文章

NGINX Yum存儲(chǔ)庫官方指南

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容