【问题标题】:Apache not serving after server restart服务器重新启动后Apache不服务
【发布时间】:2015-12-29 13:10:15
【问题描述】:

我刚刚使用 reboot 重新启动了数字海洋上的服务器,现在 apache 没有提供任何页面。我可以从我的客户端ping IP。重启前一切正常。以下是我迄今为止所做的一些测试的一些输出:

Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1005/sshd       
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1774/sendmail: MTA:
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      1241/mysqld     
tcp        0      0 127.0.0.1:587           0.0.0.0:*               LISTEN      1774/sendmail: MTA:
tcp        0      0 127.0.0.1:11211         0.0.0.0:*               LISTEN      1703/memcached  
tcp6       0      0 :::22                   :::*                    LISTEN      1005/sshd       
tcp6       0      0 :::443                  :::*                    LISTEN      2991/apache2    
tcp6       0      0 :::80                   :::*                    LISTEN      2991/apache2    

这是 netstat 的结果。我不确定,但这是否意味着 apache 没有在 IPV4 (TCP) 上监听??:

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1005/sshd       
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1774/sendmail: MTA:
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      1241/mysqld     
tcp        0      0 127.0.0.1:587           0.0.0.0:*               LISTEN      1774/sendmail: MTA:
tcp        0      0 127.0.0.1:11211         0.0.0.0:*               LISTEN      1703/memcached  
tcp6       0      0 :::22                   :::*                    LISTEN      1005/sshd       
tcp6       0      0 :::443                  :::*                    LISTEN      2991/apache2    
tcp6       0      0 :::80                   :::*                    LISTEN      2991/apache2    
udp        0      0 127.0.0.1:11211         0.0.0.0:*                           1703/memcached  

error.log 看起来没问题:

[Thu Oct 01 09:09:20.131886 2015] [mpm_prefork:notice] [pid 2991]          AH00171: Graceful restart requested, doing restart
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
[Thu Oct 01 09:09:20.213216 2015] [:notice] [pid 3176] FastCGI: process manager initialized (pid 3176)
[Thu Oct 01 09:09:20.221458 2015] [ssl:warn] [pid 2991] AH02292: Init: Name-based SSL virtual hosts only work for clients with TLS server name indication support (RFC 4366)
[Thu Oct 01 09:09:21.001486 2015] [mpm_prefork:notice] [pid 2991] AH00163: Apache/2.4.7 (Ubuntu) mod_fastcgi/mod_fastcgi-SNAP-0910052141 OpenSSL/1.0.1f configured -- resuming normal operations
[Thu Oct 01 09:09:21.002462 2015] [core:notice] [pid 2991] AH00094: Command line: '/usr/sbin/apache2'

【问题讨论】:

  • 您是否尝试过 SSH 进入您的服务器并检查配置语法错误?尝试 # httpd -t # httpd -S 示例输出应该显示“语法正常”

标签: apache ubuntu apache2


【解决方案1】:

您可以尝试多种方法来解决问题:

您可以通过 SSH 连接到您的服务器并检查配置语法错误:

#httpd -t
#httpd -S

如果 httpd.conf 配置正确,您应该会看到“Syntax OK”消息。

您可以查看 Apache 错误日志文件,它会指出确切的问题位置:

tail -f /var/log/httpd-error.log
egrep -i 'warn|error' /var/log/httpd-error.log

另一个选项是检查可能正在使用端口 80 或 443 的其他进程。使用 netstat 命令列出打开的端口及其所有者:

 # netstat -tulpn
 # netstat -tulpn | grep
 # netstat -tulpn | grep ':80'

如果其他进程使用端口 80 / 443,您需要停止它们或为 Apache 分配另一个端口。

如果以上都没有帮助,您可以检查打开文件 FD 限制、Apache/PHP/Python/CGI 日志文件大小和 DNS 配置。

希望您可以在那里尝试一些想法。

干杯

【讨论】:

  • 我在上面的帖子中添加了一些输出。我不确定,但也许 Apache 没有在 TCP 上监听 80 和 443 端口,只在 TCP6 上监听??
最近更新 更多