我无法从另一台机器上的浏览器(它给出'连接超时'错误)打我的服务器,虽然键入http://localhost或http://my-ip-here从浏览器机。 我可以ping通SSH从其他机器到服务器; 它看起来像apache拒绝端口80浏览器连接。
我能做些什么来进一步诊断/解决这个问题? 在此先感谢您的帮助。
编辑:没有防火墙。 这是我的默认网站:
keone@kserver:/etc/apache2/sites-enabled$ ls -l total 0 lrwxrwxrwx 1 root root 26 2010-12-16 15:20 000-default -> ../sites-available/default keone@kserver:/etc/apache2/sites-available$ cat default <VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www/manual <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /var/www/> Options FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory> ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ <Directory "/usr/lib/cgi-bin"> AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from all </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog ${APACHE_LOG_DIR}/access.log combined Alias /doc/ "/usr/share/doc/" <Directory "/usr/share/doc/"> Options Indexes MultiViews FollowSymLinks AllowOverride None Order deny,allow Deny from all Allow from 127.0.0.0/255.0.0.0 ::1/128 </Directory> </VirtualHost>
另外,这个和这个post似乎没有validation防火墙:
keone@kserver:/etc/apache2$ sudo /sbin/iptables -L Chain INPUT (policy ACCEPT) target prot opt source destination Chain FORWARD (policy ACCEPT) target prot opt source destination Chain OUTPUT (policy ACCEPT) target prot opt source destination keone@kserver:/etc/apache2$ sudo /sbin/iptables -t nat -L Chain PREROUTING (policy ACCEPT) target prot opt source destination Chain OUTPUT (policy ACCEPT) target prot opt source destination Chain POSTROUTING (policy ACCEPT) target prot opt source destination
在客户端和服务器上运行tcpdump也是很有帮助的,看看数据包是否能够通过
典型的交换机:tcpdump -i -n -p端口80
-n =不parsing主机名-p =非混杂模式
另一个需要检查的是你的apacheconfiguration中的listen指令,试试看:grep -ir listen / etc / httpd / thise应该是*:80或者你的ip-address:80
你需要检查apache所在的机器上运行的防火墙 – 它可能阻塞了80端口。一旦这个解除阻塞,你应该可以从另一台机器上达到这个目的。
步骤1,2应该让你知道问题出在哪里。 此外,请检查您的Apacheconfiguration..确保允许从本地主机/拒绝所有没有提到你的默认网站的configuration。
在您的客户端计算机上,通过端口80 telnet到服务器。
如果结果是连接被拒绝,那么唯一的原因是防火墙阻塞(你说它closures)或者Apache不在公共IP上运行。
如果结果超时,并且ping正在工作,除了防火墙,我看不到任何其他的原因。
如果连接起来,那么你至less已经到达了Apache,并且知道问题在这一边。