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. * . * . * (eg 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>
When I change port eg Listen 82
then I can connect to localhost:82 or 127.0.0.1:82
There are no any processes using port 80, except apache2:
$sudo netstat -tulpn | grep 80
=> tcp6 0 0 :::80 :::* LISTEN 7127/apache2
There are three files in /var/log/apache2/:
access.log, error.log and other_vhosts_access.log
When restarting 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.
I installed apache on other ubuntu14.04 system and all works.
What cause blocking port 80, do you know in what the problem is?
This question related to https://serverfault.com/questions/670575/failed-to-connect-to-127-0-0-1-port-80 .
No any process blocking port 80. Problem related to firewall NAT rules which are redirecting connections to 80 port to another disabled port. It fixed with removing these rules.
I had the same problem. In my apache's httpd.conf file, I had
Listen 198.166.2.1:8000
then I changed it to:
Listen 8000
and it worked both with localhost and with the ip address.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.