有时在nginx安装部署后,service nginx 命令无效,需配置nginx.service使之生效;
vim /usr/lib/systemd/system/nginx.service
[Unit] Description=nginx - high performance web server Documentation=http://nginx.org/en/docs After=network.target remote-fs.target nss-lookup.target [Service] Type=forking PIDFile=/usr/local/nginx/logs/nginx.pid
ExecStartPre=/usr/bin/rm -f $PIDFile 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=/bin/kill -s HUP $MAINPID ExecStop=/bin/kill -s QUIT $MAINPID PrivateTmp=true [Install] WantedBy=multi-user.target
wq!保存退出
赋予执行权限
chmod +x /usr/lib/systemd/system/nginx.service
启动服务
systemctl daemon-reload
service nginx start
标签:target,service,配置,nginx,usr,conf,local From: https://www.cnblogs.com/chencoolandclear/p/16770793.html