简体   繁体   English

有一个nginx进程正在监听端口80,但我不知道它是如何到达的

[英]There's an nginx process listening on port 80 and I don't know how it got there

I use a digital ocean droplet as my development environment. 我使用数字海洋飞沫作为开发环境。 The droplet is DO's LAMP stack droplet on Ubuntu 14.04. 该小滴是Ubuntu 14.04上DO的LAMP堆栈小滴。 I've got apache running to access my mysql database with phpmyadmin. 我已经运行apache以使用phpmyadmin访问我的mysql数据库。

Recently phpmyadmin stopped working inexplicably. 最近phpmyadmin莫名其妙地停止工作。 I checked it out and it looked like apache wasn't starting properly. 我检查了一下,看来apache的启动不正确。 I get the following error: 我收到以下错误:

 * Restarting web server apache2
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message
(98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
(98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs
Action 'start' failed.
The Apache error log may have more information.\

So it looks like port 80 is being taken up by another process. 因此,看起来端口80正在被另一个进程占用。 Someone suggested to me that I use netstat to figure out which process it is. 有人建议我使用netstat找出它是哪个进程。 Sure enough sudo netstat -tapen | grep ":80" 足够的sudo netstat -tapen | grep ":80" sudo netstat -tapen | grep ":80" revealed that there were some other processes listening on port 80: sudo netstat -tapen | grep ":80"透露端口80上还有其他进程在监听:

tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      0          8849        920/nginx
tcp        0      0 104.131.29.69:8000      0.0.0.0:*               LISTEN      1000       10361       1683/php5       
tcp6       0      0 :::80                   :::*                    LISTEN      0          8850        920/nginx

So I tried to kill the process as per this answer. 因此,我尝试按照答案终止该过程。 When I did, running netstat again yielded this 当我这样做时,再次运行netstat产生这种情况

tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      0          8849        921/nginx: worker p
tcp        0      0 104.131.29.69:8000      0.0.0.0:*               LISTEN      1000       10361       1683/php5       
tcp6       0      0 :::80                   :::*                    LISTEN      0          8850        921/nginx: worker p

So the process seems to have just changed numbers but didn't die. 因此,该过程似乎只是更改了数字,但没有消失。

I also tried this answer but nothing changed. 我也尝试了这个答案,但没有任何改变。

I have no idea what this nginx process is--I don't remember having ever started an nginx process on my server and in case I don't know how it could have survived my restarting the server various times (which I also tried). 我不知道这个Nginx进程是什么-我不记得曾经在我的服务器上启动过Nginx进程,以防万一我不知道它在重启服务器的过程中如何生存(我也尝试过) 。 Several people suggested using netstat to find out what's listening on the port but I'm not sure what to do now that I've found it. 一些人建议使用netstat来找出端口上正在侦听的内容,但是我不知道现在该怎么做。 Also why is it surviving my restarting the server? 另外,为什么重启我的服务器后还能幸免? I'm pretty sure apache, or the php server that you see up there would both have to be restarted when the server's turned off. 我非常确定apache,或者您在其中看到的php服务器都必须在服务器关闭时都重新启动。

Thanks. 谢谢。

This command will show you which process is using port 80: 此命令将向您显示哪个进程正在使用端口80:

sudo lsof -i:80

Make sure to use "sudo". 确保使用“ sudo”。

可能是一个初始化服务,它将在系统启动时重新启动。

使用以下命令停止nginx。

sudo /etc/init.d/nginx stop

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Apache在另一个端口上侦听,但是如何获取它,所以我不必键入端口号? - Apache is listening on a different port, but how do I get it so I don't have to type in the port number? 如何从 static 网页链接到在 80 以外的端口上侦听的 node.js 应用程序? - How can I link to a node.js application listening on a port other than 80 from a static webpage? Nginx(代理)+ Apache:两个进程监听相同的端口 - Nginx(proxy) + Apache: two process listening same port 如何更改厨师nginx默认http端口80? - How to change chef nginx default http port 80? Apache 更新后如何修复 Cerbot 错误“无法找到侦听端口 80 的虚拟主机”? - How to fix Cerbot error 'Unable to find a virtual host listening on port 80' after Apache Update? 网站监听端口80和443时,如何在apache中将301重定向http到https? - How to do 301 redirect http to https in apache when website listening port 80 and 443? NGINX反向代理将端口80更改为8080 - NGINX reverse proxy change port 80 to 8080 服务器监听localhost:8080,Apache仍然可以监听端口80吗? - Server listening to localhost:8080 can Apache still listen to port 80? 如何将IIS express 8端口80更改为8080 - how do I change IIS express 8 port 80 to 8080 如何通过htaccess将端口80重定向到其他位置? - How can I redirect port 80 to a different location through htaccess?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM