在rhel7.3上编写一个nginx启动脚本

vim /usr/lib/systemd/system/nginx.service

[Unit]
Description=The nginx HTTP Server
After=network.target

[Service]
Type=forking
ExecStart=/usr/local/nginx/sbin/nginx
ExecReload=/usr/local/nginx/sbin/nginx -s reload
ExecStop=/usr/local/nginx/sbin/nginx -s quit
PrivateTmp=true

[Install]
WantedBy=multi-user.target
systemctl daemon-reload   # 刷新配置

测试:

发布了124 篇原创文章 · 获赞 19 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/lm236236/article/details/89931006