系统相关
首页 > 系统相关> > Nginx开机自启配置

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

标签:sbin,nginx,自启,Nginx,systemctl,&&,开机
来源: https://www.cnblogs.com/cjzzz/p/16338433.html