centos系统下nginx启动不了怎么办

centos系统下nginx启动不了怎么办

问题:

源码安装nginx后启动时报如下错误”

Failed to start nginx.service: Unit not found.

解决方法:

(推荐教程:centos使用教程

这时候我们需要在系统服务目录里面创建nginx文件。

vi /lib/systemd/system/nginx.service

然后复制以下内容

[Unit] Description=nginx 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.service

相关视频教程推荐:centos使用教程

以上就是

© 版权声明
THE END
喜欢就支持一下吧
点赞11 分享