有一个 nginx 进程在监听 80 端口,我不知道它是怎么到那里的
There's an nginx process listening on port 80 and I don't know how it got there
我使用数字海洋水滴作为我的开发环境。该液滴是 Ubuntu 14.04 上 DO 的 LAMP 堆栈液滴。我有 apache 运行 使用 phpmyadmin.
访问我的 mysql 数据库
最近phpmyadmin 莫名停止工作。我检查了一下,看起来 apache 没有正常启动。我收到以下错误:
* 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.\
看来端口 80 正在被另一个进程占用。有人向我建议我使用 netstat
来确定它是哪个进程。果然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
所以我试图根据 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
所以这个进程好像只是换了个号但并没有死掉。
我也尝试了 this 答案,但没有任何改变。
我不知道这个 nginx 进程是什么——我不记得曾经在我的服务器上启动过 nginx 进程,以防我不知道它是如何在我多次重启服务器后幸存下来的(我也试过)。有几个人建议使用 netstat 来找出端口上正在侦听的内容,但我不确定现在我已经找到了该怎么做。还有为什么它在我重新启动服务器后仍然存在?我很确定 apache 或您在上面看到的 php 服务器在服务器关闭时都必须重新启动。
谢谢。
此命令将显示哪个进程正在使用端口 80:
sudo lsof -i:80
确保使用 "sudo".
可能是一个 init 服务,它将在系统启动时重新启动。
使用以下命令停止 nginx。
sudo /etc/init.d/nginx stop
我使用数字海洋水滴作为我的开发环境。该液滴是 Ubuntu 14.04 上 DO 的 LAMP 堆栈液滴。我有 apache 运行 使用 phpmyadmin.
访问我的 mysql 数据库最近phpmyadmin 莫名停止工作。我检查了一下,看起来 apache 没有正常启动。我收到以下错误:
* 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.\
看来端口 80 正在被另一个进程占用。有人向我建议我使用 netstat
来确定它是哪个进程。果然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
所以我试图根据 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
所以这个进程好像只是换了个号但并没有死掉。
我也尝试了 this 答案,但没有任何改变。
我不知道这个 nginx 进程是什么——我不记得曾经在我的服务器上启动过 nginx 进程,以防我不知道它是如何在我多次重启服务器后幸存下来的(我也试过)。有几个人建议使用 netstat 来找出端口上正在侦听的内容,但我不确定现在我已经找到了该怎么做。还有为什么它在我重新启动服务器后仍然存在?我很确定 apache 或您在上面看到的 php 服务器在服务器关闭时都必须重新启动。
谢谢。
此命令将显示哪个进程正在使用端口 80:
sudo lsof -i:80
确保使用 "sudo".
可能是一个 init 服务,它将在系统启动时重新启动。
使用以下命令停止 nginx。
sudo /etc/init.d/nginx stop