![Nginx 98:地址已被使用 - 无法启动高性能 Web 服务器问题](https://linux22.com/image/687687/Nginx%2098%EF%BC%9A%E5%9C%B0%E5%9D%80%E5%B7%B2%E8%A2%AB%E4%BD%BF%E7%94%A8%20-%20%E6%97%A0%E6%B3%95%E5%90%AF%E5%8A%A8%E9%AB%98%E6%80%A7%E8%83%BD%20Web%20%E6%9C%8D%E5%8A%A1%E5%99%A8%E9%97%AE%E9%A2%98%20.png)
我的服务器运行良好...直到重新启动,重新启动后 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。