apache/application 运行 ubuntu 未响应连接请求
apache/application running on ubuntu not responding connection requests
我的 ubuntu 系统上有 apache 服务器 运行,但是当我尝试使用 IE chrome、postman 通过我的 windows 系统访问时,我出现错误(网站在线但未响应连接尝试)。
我在我的 ubuntu 系统上完成了 tcpdump,我得到了以下日志
(10.223.186.65是我windows系统的ip,10.223.197.177是我linux系统的ip)
sudo tcpdump -i ens2f0 'port 80'
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on ens2f0, link-type EN10MB (Ethernet), capture size 262144 bytes
18:38:07.437762 IP 10.223.186.65.49279 > 10.223.197.177.http: Flags [S], seq 1024624045, win 65535, options [mss 1460,nop,wscale 8,nop,nop,sackOK], length 0
18:38:08.442487 IP 10.223.186.65.49279 > 10.223.197.177.http: Flags [S], seq 1024624045, win 65535, options [mss 1460,nop,wscale 8,nop,nop,sackOK], length 0
18:38:10.442214 IP 10.223.186.65.49279 > 10.223.197.177.http: Flags [S], seq 1024624045, win 65535, options [mss 1460,nop,nop,sackOK], length 0
18:38:22.291090 IP 10.223.186.65.49287 > 10.223.197.177.http: Flags [S], seq 4095681508, win 65535, options [mss 1460,nop,wscale 8,nop,nop,sackOK], length 0
18:38:23.297443 IP 10.223.186.65.49287 > 10.223.197.177.http: Flags [S], seq 4095681508, win 65535, options [mss 1460,nop,wscale 8,nop,nop,sackOK], length 0
18:38:25.297053 IP 10.223.186.65.49287 > 10.223.197.177.http: Flags [S], seq 4095681508, win 65535, options [mss 1460,nop,nop,sackOK], length 0
18:38:33.501498 IP 10.223.186.65.49288 > 10.223.197.177.http: Flags [S], seq 2981170598, win 8192, options [mss 1460,nop,wscale 8,nop,nop,sackOK], length 0
18:38:34.510766 IP 10.223.186.65.49288 > 10.223.197.177.http: Flags [S], seq 2981170598, win 8192, options [mss 1460,nop,wscale 8,nop,nop,sackOK], length 0
18:38:36.511607 IP 10.223.186.65.49288 > 10.223.197.177.http: Flags [S], seq 2981170598, win 8192, options [mss 1460,nop,nop,sackOK], length 0
18:38:39.849683 IP 10.223.186.65.49290 > 10.223.197.177.http: Flags [S], seq 2142699807, win 8192, options [mss 1460,nop,wscale 8,nop,nop,sackOK], length 0
18:38:40.056095 IP 10.223.186.65.49291 > 10.223.197.177.http: Flags [S], seq 2881184651, win 8192, options [mss 1460,nop,wscale 8,nop,nop,sackOK], length 0
18:38:40.562896 IP 10.223.186.65.49292 > 10.223.197.177.http: Flags [S], seq 951667956, win 8192, options [mss 1460,nop,wscale 8,nop,nop,sackOK], length 0
18:38:42.807829 IP 10.223.186.65.49290 > 10.223.197.177.http: Flags [S], seq 2142699807, win 8192, options [mss 1460,nop,wscale 8,nop,nop,sackOK], length 0
18:38:43.056197 IP 10.223.186.65.49291 > 10.223.197.177.http: Flags [S], seq 2881184651, win 8192, options [mss 1460,nop,wscale 8,nop,nop,sackOK], length 0
18:38:43.560534 IP 10.223.186.65.49292 > 10.223.197.177.http: Flags [S], seq 951667956, win 8192, options [mss 1460,nop,wscale 8,nop,nop,sackOK], length 0
18:38:48.806808 IP 10.223.186.65.49290 > 10.223.197.177.http: Flags [S], seq 2142699807, win 8192, options [mss 1460,nop,nop,sackOK], length 0
18:38:49.052968 IP 10.223.186.65.49291 > 10.223.197.177.http: Flags [S], seq 2881184651, win 8192, options [mss 1460,nop,nop,sackOK], length 0
18:38:49.568802 IP 10.223.186.65.49292 > 10.223.197.177.http: Flags [S], seq 951667956, win 8192, options [mss 1460,nop,nop,sackOK], length 0
sudo netstat -anp | grep apache
tcp6 0 0 :::5000 :::* LISTEN 6094/apache2
tcp6 0 0 :::80 :::* LISTEN 6094/apache2
tcp6 0 0 :::35357 :::* LISTEN 6094/apache2
unix 2 [ ACC ] STREAM LISTENING 40684 6094/apache2 /var/run/apache2.6094.0.1.sock
unix 2 [ ACC ] STREAM LISTENING 40685 6094/apache2 /var/run/apache2.6094.0.2.sock
unix 2 [ ACC ] STREAM LISTENING 40686 6094/apache2 /var/run/apache2.6094.0.3.sock
unix 2 [ ACC ] STREAM LISTENING 40687 6094/apache2 /var/run/apache2.6094.0.4.sock
wget 10.223.197.177:80(在同一个 ubuntu 系统上工作正常)
Apache 运行 在端口 80 上,但我仍然无法在我的浏览器上获得输出,我尝试了 chrome 和 IE.I 在另一个 ubuntu 上有类似的设置] 有效的系统 fine.I 知道问题出在我的 ubuntu 系统上,但无法追踪 it.Could 任何人请帮助我调试问题我 facing.Has 任何人随时都遇到同样的问题
您已验证 Apache 是 运行(通过本地系统的 netstat
和 wget
)并且您已开始进行数据包捕获以验证 ARP 是否正常工作以及 TCP 数据包到达目的地。竖起大拇指。 :)
当数据包到达目的地但没有回复时,(通常)有两个根本原因:
- 应用程序配置错误或
- 有些东西丢弃或重新路由数据包
根据您发布的内容,让我们检查一下这两项:
对于应用程序,请检查您的 httpd.conf
文件并确保您的访问控制设置正确。忽略安全性,它应该看起来像这样(来自默认的 CentOS 安装):
<Directory /var/www/html>
# This statement will allow everyone to access the
# web server once they are able to reach it over TCP.
Require all granted
</Directory>
此外,请查看 Apache 日志(它们可能设置在 httpd.conf
文件中的 <CustomLog>
下,否则它们应该在 /var/log/
下的某处)。检查尝试连接时是否有任何错误消息 - 如果 Apache 配置阻止访问,您应该会在日志中看到它。
关于网络,假设您的 Apache 访问控制设置正确,请检查是否有东西正在丢弃数据包。查看您是否启用了任何防火墙规则:sudo ufw status
。如果这样做,您可以尝试使用 sudo ufw disable
禁用防火墙,这将刷新 Ubuntu 框中的所有防火墙规则,尽管它们会在重新启动时 return。
*为 Ubuntu UFW 而不是 CentOS iptables 命令编辑。
我的 ubuntu 系统上有 apache 服务器 运行,但是当我尝试使用 IE chrome、postman 通过我的 windows 系统访问时,我出现错误(网站在线但未响应连接尝试)。
我在我的 ubuntu 系统上完成了 tcpdump,我得到了以下日志
(10.223.186.65是我windows系统的ip,10.223.197.177是我linux系统的ip)
sudo tcpdump -i ens2f0 'port 80'
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on ens2f0, link-type EN10MB (Ethernet), capture size 262144 bytes
18:38:07.437762 IP 10.223.186.65.49279 > 10.223.197.177.http: Flags [S], seq 1024624045, win 65535, options [mss 1460,nop,wscale 8,nop,nop,sackOK], length 0
18:38:08.442487 IP 10.223.186.65.49279 > 10.223.197.177.http: Flags [S], seq 1024624045, win 65535, options [mss 1460,nop,wscale 8,nop,nop,sackOK], length 0
18:38:10.442214 IP 10.223.186.65.49279 > 10.223.197.177.http: Flags [S], seq 1024624045, win 65535, options [mss 1460,nop,nop,sackOK], length 0
18:38:22.291090 IP 10.223.186.65.49287 > 10.223.197.177.http: Flags [S], seq 4095681508, win 65535, options [mss 1460,nop,wscale 8,nop,nop,sackOK], length 0
18:38:23.297443 IP 10.223.186.65.49287 > 10.223.197.177.http: Flags [S], seq 4095681508, win 65535, options [mss 1460,nop,wscale 8,nop,nop,sackOK], length 0
18:38:25.297053 IP 10.223.186.65.49287 > 10.223.197.177.http: Flags [S], seq 4095681508, win 65535, options [mss 1460,nop,nop,sackOK], length 0
18:38:33.501498 IP 10.223.186.65.49288 > 10.223.197.177.http: Flags [S], seq 2981170598, win 8192, options [mss 1460,nop,wscale 8,nop,nop,sackOK], length 0
18:38:34.510766 IP 10.223.186.65.49288 > 10.223.197.177.http: Flags [S], seq 2981170598, win 8192, options [mss 1460,nop,wscale 8,nop,nop,sackOK], length 0
18:38:36.511607 IP 10.223.186.65.49288 > 10.223.197.177.http: Flags [S], seq 2981170598, win 8192, options [mss 1460,nop,nop,sackOK], length 0
18:38:39.849683 IP 10.223.186.65.49290 > 10.223.197.177.http: Flags [S], seq 2142699807, win 8192, options [mss 1460,nop,wscale 8,nop,nop,sackOK], length 0
18:38:40.056095 IP 10.223.186.65.49291 > 10.223.197.177.http: Flags [S], seq 2881184651, win 8192, options [mss 1460,nop,wscale 8,nop,nop,sackOK], length 0
18:38:40.562896 IP 10.223.186.65.49292 > 10.223.197.177.http: Flags [S], seq 951667956, win 8192, options [mss 1460,nop,wscale 8,nop,nop,sackOK], length 0
18:38:42.807829 IP 10.223.186.65.49290 > 10.223.197.177.http: Flags [S], seq 2142699807, win 8192, options [mss 1460,nop,wscale 8,nop,nop,sackOK], length 0
18:38:43.056197 IP 10.223.186.65.49291 > 10.223.197.177.http: Flags [S], seq 2881184651, win 8192, options [mss 1460,nop,wscale 8,nop,nop,sackOK], length 0
18:38:43.560534 IP 10.223.186.65.49292 > 10.223.197.177.http: Flags [S], seq 951667956, win 8192, options [mss 1460,nop,wscale 8,nop,nop,sackOK], length 0
18:38:48.806808 IP 10.223.186.65.49290 > 10.223.197.177.http: Flags [S], seq 2142699807, win 8192, options [mss 1460,nop,nop,sackOK], length 0
18:38:49.052968 IP 10.223.186.65.49291 > 10.223.197.177.http: Flags [S], seq 2881184651, win 8192, options [mss 1460,nop,nop,sackOK], length 0
18:38:49.568802 IP 10.223.186.65.49292 > 10.223.197.177.http: Flags [S], seq 951667956, win 8192, options [mss 1460,nop,nop,sackOK], length 0
sudo netstat -anp | grep apache
tcp6 0 0 :::5000 :::* LISTEN 6094/apache2
tcp6 0 0 :::80 :::* LISTEN 6094/apache2
tcp6 0 0 :::35357 :::* LISTEN 6094/apache2
unix 2 [ ACC ] STREAM LISTENING 40684 6094/apache2 /var/run/apache2.6094.0.1.sock
unix 2 [ ACC ] STREAM LISTENING 40685 6094/apache2 /var/run/apache2.6094.0.2.sock
unix 2 [ ACC ] STREAM LISTENING 40686 6094/apache2 /var/run/apache2.6094.0.3.sock
unix 2 [ ACC ] STREAM LISTENING 40687 6094/apache2 /var/run/apache2.6094.0.4.sock
wget 10.223.197.177:80(在同一个 ubuntu 系统上工作正常)
Apache 运行 在端口 80 上,但我仍然无法在我的浏览器上获得输出,我尝试了 chrome 和 IE.I 在另一个 ubuntu 上有类似的设置] 有效的系统 fine.I 知道问题出在我的 ubuntu 系统上,但无法追踪 it.Could 任何人请帮助我调试问题我 facing.Has 任何人随时都遇到同样的问题
您已验证 Apache 是 运行(通过本地系统的 netstat
和 wget
)并且您已开始进行数据包捕获以验证 ARP 是否正常工作以及 TCP 数据包到达目的地。竖起大拇指。 :)
当数据包到达目的地但没有回复时,(通常)有两个根本原因:
- 应用程序配置错误或
- 有些东西丢弃或重新路由数据包
根据您发布的内容,让我们检查一下这两项:
对于应用程序,请检查您的 httpd.conf
文件并确保您的访问控制设置正确。忽略安全性,它应该看起来像这样(来自默认的 CentOS 安装):
<Directory /var/www/html>
# This statement will allow everyone to access the
# web server once they are able to reach it over TCP.
Require all granted
</Directory>
此外,请查看 Apache 日志(它们可能设置在 httpd.conf
文件中的 <CustomLog>
下,否则它们应该在 /var/log/
下的某处)。检查尝试连接时是否有任何错误消息 - 如果 Apache 配置阻止访问,您应该会在日志中看到它。
关于网络,假设您的 Apache 访问控制设置正确,请检查是否有东西正在丢弃数据包。查看您是否启用了任何防火墙规则:sudo ufw status
。如果这样做,您可以尝试使用 sudo ufw disable
禁用防火墙,这将刷新 Ubuntu 框中的所有防火墙规则,尽管它们会在重新启动时 return。
*为 Ubuntu UFW 而不是 CentOS iptables 命令编辑。