首頁  >  文章  >  運維  >  設定nginx開機自啟動的方法

設定nginx開機自啟動的方法

王林
王林轉載
2020-11-09 15:49:054265瀏覽

設定nginx開機自啟動的方法

特定步驟如下:

新nginx.service檔案 

vim /lib/systemd/system/nginx.service

 內容:

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

開機自動啟動 

systemctl enable nginx.service

相關推薦:nginx教學

以上是設定nginx開機自啟動的方法的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文轉載於:csdn.net。如有侵權,請聯絡admin@php.cn刪除