我的服务器运行良好...直到重新启动,重新启动后 Nginx 运行不佳!
操作系统:Ubuntu 服务器
nginx 版本:nginx/1.10.0(Ubuntu)
HHVM 脚本服务器
我尝试了很多方法但无法解决这个问题:
配置已确定。
nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
Aug 06 16:05:48 HHVM systemd[1]: Starting A high performance web server and a reverse proxy server...
-- Subject: Unit nginx.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit nginx.service has begun starting up.
Aug 06 16:05:48 HHVM nginx[1618]: nginx: [emerg] listen() to 0.0.0.0:80, backlog 511 failed (98: Address already in use)
Aug 06 16:05:49 HHVM nginx[1618]: nginx: [emerg] listen() to 0.0.0.0:80, backlog 511 failed (98: Address already in use)
Aug 06 16:05:49 HHVM nginx[1618]: nginx: [emerg] listen() to 0.0.0.0:80, backlog 511 failed (98: Address already in use)
Aug 06 16:05:50 HHVM nginx[1618]: nginx: [emerg] listen() to 0.0.0.0:80, backlog 511 failed (98: Address already in use)
Aug 06 16:05:50 HHVM nginx[1618]: nginx: [emerg] listen() to 0.0.0.0:80, backlog 511 failed (98: Address already in use)
Aug 06 16:05:51 HHVM nginx[1618]: nginx: [emerg] still could not bind()
Aug 06 16:05:51 HHVM systemd[1]: nginx.service: Control process exited, code=exited status=1
Aug 06 16:05:51 HHVM systemd[1]: Failed to start A high performance web server and a reverse proxy server.
-- Subject: Unit nginx.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit nginx.service has failed.
--
-- The result is failed.
Aug 06 16:05:51 HHVM systemd[1]: nginx.service: Unit entered failed state.
Aug 06 16:05:51 HHVM systemd[1]: nginx.service: Failed with result 'exit-code'.
NginX 正在运行,我在 Web 浏览器上看到“404 文件未找到”,这意味着 hhvm 没有运行。
我该如何修复它?
答案1
首先你需要找到pid
它,nginx
这样你就可以杀死它。要找到它,pid
只需输入
ps aux | grep nginx
一旦找到pid
,您就可以像这样终止该进程。
kill -9 <pid>
但最简单的方法是使用以下命令重新启动它:
sudo service nginx restart
或者
sudo service nginx stop
sudo service nginx start
如果您需要更多帮助请告诉我。
答案2
您需要检查哪个进程正在监听端口 80,并确保 systemd 中已禁用该服务。您可以使用netstat -lnp
命令找到该进程,在输出中查找端口 80。