FastDFS(https://github.com/happyfish100/fastdfs/wiki)推荐的nginx启动方式是直接执行/usr/local/nginx/sbin/nginx
如果配成用systemctl管理的话,更符合常规使用习惯,而且可以设为开机启动,具体如下:
- /lib/systemd/system/nginx.service
[Unit]
Description=nginx - high performance web server
After=network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
PIDFile=/usr/local/nginx/logs/nginx.pid
ExecStartPre=/usr/local/nginx/sbin/nginx -t -c /usr/local/nginx/conf/nginx.conf
ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
ExecReload=/usr/local/nginx/sbin/nginx -s reload
ExecStop=/usr/local/nginx/sbin/nginx -s stop
ExecQuit=/usr/local/nginx/sbin/nginx -s quit
PrivateTmp=true
[Install]
WantedBy=multi-user.target
- Reload and enable
systemctl daemon-reload
systemctl start nginx
systemctl enable nginx
标签:sbin,编译,nginx,Nginx,systemctl,usr,conf,local
From: https://www.cnblogs.com/waketzheng/p/18076832