nginx安裝及開機啓動配置

安裝
https://www.runoob.com/linux/nginx-install-setup.html?spm=a2c4g.11186623.2.19.31059a80v7aaTf

配置開機啓動
vi /lib/systemd/system/nginx.service

[Unit]
Description=nginx
After=network.target
 
[Service]
Type=forking
ExecStart=/usr/local/webserver/nginx/sbin/nginx
ExecReload=/usr/local/webserver/nginx/sbin/nginx -s reload
ExecStop=/usr/local/webserver/nginx/sbin/nginx -s stop
PrivateTmp=true
 
[Install]
WantedBy=multi-user.target

設置開機啓動
systemctl enable nginx.service

 

systemctl start nginx.service (啓動nginx服務)
systemctl stop nginx.service (停止nginx服務)
systemctl enable nginx.service (設置開機自啓動)
systemctl disable nginx.service (停止開機自啓動)
systemctl status nginx.service (查看服務當前狀態)
systemctl restart nginx.service (重新啓動服務)
systemctl list-units --type=service (查看所有已啓動的服務)

 

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