
问题:
源码安装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
相关视频教程推荐:linux视频教程
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号