日本免费高清视频-国产福利视频导航-黄色在线播放国产-天天操天天操天天操天天操|www.shdianci.com

學無先后,達者為師

網(wǎng)站首頁 編程語言 正文

Linux配置nginx開機自啟

作者:YXWik6 更新時間: 2022-07-12 編程語言

1.先創(chuàng)建開機自啟腳本

cd /etc/systemd/system
 vi nginx.service

內(nèi)容:

[Unit]
Description=nginx service
After=network.target

[Service]
Type=forking
ExecStart=/usr/local/nginx/sbin/nginx
ExecReload=/usr/local/nginx/sbin/nginx -s reload
ExecStop=/usr/local/nginx/sbin/nginx -s quit
PrivateTmp=true

[Install]
WantedBy=multi-user.target

2.設置開機自啟動

systemctl enable nginx

3.啟動nginx服務

systemctl start nginx.service

重新啟動服務

systemctl restart nginx.service

查看服務當前狀態(tài)

systemctl status nginx.service

停止開機自啟動

systemctl disable nginx.service

原文鏈接:https://blog.csdn.net/YXWik/article/details/123405660

欄目分類
最近更新