问题描述
在ubuntu 14.04中运行apache服务器时,我在浏览器中或在"curl: (7) Failed to connect to localhost port 80: Connection refused"
中使用$ curl localhost
获得"This webpage is not available"
.此外,我可以连接到127. *. *(例如127.0.0.2)-不适用于127.0.0.1
On running apache server in ubuntu 14.04 I get "This webpage is not available"
in browser or "curl: (7) Failed to connect to localhost port 80: Connection refused"
using $ curl localhost
. Besides I can connect to 127. * . * . * (e.g. 127.0.0.2) - doesn't work only 127.0.0.1
/etc/hosts
127.0.0.1 localhost
127.0.1.1 al-ubuntu
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ports.conf
Listen 80
<IfModule ssl_module>
Listen 443
</IfModule>
<IfModule mod_gnutls.c>
Listen 443
</IfModule>
当我更改端口时Listen 82
然后我可以连接到localhost:82或127.0.0.1:82
When I change port e.g. Listen 82
then I can connect to localhost:82 or 127.0.0.1:82
除apache2外,没有使用端口80的任何进程:
$sudo netstat -tulpn | grep 80
=> tcp6 0 0 :::80 :::* LISTEN 7127/apache2
/var/log/apache2/中有三个文件:
access.log, error.log and other_vhosts_access.log
重新启动apache2时: $ tail -f error.log
[Thu Feb 19 16:03:19.570066 2015] [mpm_prefork:notice] [pid 1285] AH00169:
caught SIGTERM, shutting down
[Thu Feb 19 16:03:20.673519 2015] [mpm_prefork:notice] [pid 3454] AH00163:
Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.6 configured -- resuming normal
operations
[Thu Feb 19 16:03:20.674355 2015] [core:notice] [pid 3454] AH00094: Command line: '/usr/sbin/apache2'
在所有日志文件中连接到本地主机时,什么都没有.
When connecting to localhost in all log files - nothing.
我在其他ubuntu14.04系统上安装了Apache,并且所有工作正常.
I installed apache on other ubuntu14.04 system and all works.
造成端口80阻塞的原因是什么,您知道是什么问题吗?
What cause blocking port 80, do you know in what the problem is?
推荐答案
我遇到了同样的问题.在我的apache的httpd.conf文件中,我有
I had the same problem.In my apache's httpd.conf file, I had
Listen 198.166.2.1:8000
然后我将其更改为:
Listen 8000
它可以与localhost和ip地址一起使用.
and it worked both with localhost and with the ip address.
这篇关于在正在运行的apache服务器上无法访问http://localhost:80的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!