[英]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.