Nginx开机自启配置

Nginx 开机自启配置

vi /lib/systemd/system/nginx.service

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

#加入开机自启 && 启停测试
systemctl enable nginx && systemctl start nginx && systemctl stop nginx

posted @ 2022-06-05 02:21  RFAA  阅读(154)  评论(0编辑  收藏  举报