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