首页 文章

Apache2:尝试启动它时“已经在使用地址”('httpd.pid'问题?)

提问于
浏览
0

在Linux上使用Apache2时,我在尝试启动它时收到此错误消息 .

$ sudo / usr / local / apache2 / bin / apachectl start

httpd not running, trying to start
(98)Address already in use: make_sock: unable to listen for connections on address 127.0.0.1:80
no listening sockets available, shutting down
Unable to open logs

$ sudo / usr / local / apache2 / bin / apachectl stop

httpd (no pid file) not running

一些事实:

  • 这是我的Apache日志中的最后一行:

[Mon Jun 19 18:29:01 2017] [warn] pid文件/usr/local/apache2/logs/httpd.pid被覆盖 - 以前Apache运行的不干净关闭?

  • 我的'/usr/local/apache2/conf/httpd.conf'包含Listen 127.0.0.1:80

  • 我在'/etc/apache2/ports.conf'配置了“Listen 80”

  • 磁盘未满

  • 我已经检查过“/usr/local/apache2/conf/httpd.conf”中没有两个或更多“Listen”

一些产出:

$ sudo ps -ef | grep apache

root      1432     1  0 17:35 ?        00:00:00 /usr/sbin/apache2 -k start
www-data  1435  1432  0 17:35 ?        00:00:00 /usr/sbin/apache2 -k start
www-data  1436  1432  0 17:35 ?        00:00:00 /usr/sbin/apache2 -k start
myuserr   1775  1685  0 17:37 pts/1    00:00:00 grep --color=auto apache

$ sudo grep -ri listen / etc / apache2

/etc/apache2/apache2.conf:#   supposed to determine listening ports for incoming connections which can be
/etc/apache2/apache2.conf:# Include list of ports to listen on
/etc/apache2/ports.conf:Listen 80
/etc/apache2/ports.conf:    Listen 443
/etc/apache2/ports.conf:    Listen 443

我该怎么做才能重启Apache?我应该修复'httpd.pid'吗?

2 回答

  • 0

    此错误意味着某些东西已经使用80端口 . 如果您在apache配置中确实没有2行 Listen 80 ,那么执行此命令以查看使用80端口的内容: netstat -antp | grep 80 .

  • 0

    我通过杀死三个进程来修复它

    root      1621     1  0 18:46 ?        00:00:00 /usr/sbin/apache2 -k start
    www-data  1624  1621  0 18:46 ?        00:00:00 /usr/sbin/apache2 -k start
    www-data  1625  1621  0 18:46 ?        00:00:00 /usr/sbin/apache2 -k start
    

    但是,每次我想重启我的服务器时,我都必须杀死你的进程 . 是什么开始的?

相关问题