vi /usr/lib/systemd/system/nginx.service
[Service]
Type=forking
PIDFile=/usr/local/openresty/nginx/logs/nginx.pid
ExecStartPre=/usr/local/openresty/nginx/sbin/nginx -t
ExecStart=/usr/local/openresty/nginx/sbin/nginx
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
systemctl daemon-reload
systemctl enable nginx.service
systemctl start nginx.service
本文详细介绍了如何配置Nginx服务的systemd启动脚本,包括设置forking类型、PID文件路径、预启动、启动、重新加载及停止命令。通过修改执行路径和参数,确保Nginx服务能正确地在Linux环境下运行。
1084

被折叠的 条评论
为什么被折叠?



