标签:net stop code vat usr unit get multi top
Nginx安装好后,每次启动或者重启需要进入到/usr/local/nginx下操作,比较麻烦,于是把Nginx添加到系统服务中方便管理:# 添加nginx.service
# vim /lib/systemd/system/nginx.service
[Unit]
Description=nginx service
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 start nginx等进行管理,例如添加开机自启动:
systemctl enable nginx.service
标签:net stop code vat usr unit get multi top
原文地址:https://blog.51cto.com/bilibili/2411078