We are facing one weird problem on one of our RHEL apache server.

Actually, it is not listening on port 80 from remote hosts. When we locally browse http://localhost it is opening default page. When we checked listening port through netstat, we found that only tcp6 interface was listening at :::80. And there was no entry for tcp, and that entry should be present there like

tcp 0 0* LISTEN

I have tried searching many forums for this issue, but none of the solution suggested worked. In httpd.conf, we change Listen 80 to Listen Listen but it did not open 80 port to access from remote hosts. IPtables is disabled from the beginning.

How can we set the server to listen on IPv4?

  • 1
    You could try to set net.ipv6.bindv6only=0 in /etc/sysctl.conf and then run sudo sysctl -p. This makes the socket listen on both IPv4 and IPv6. Aug 24, 2017 at 14:37
  • 3
    tcp6 0 0 :::80 Is indicative of the server listening both in IPv4 and IPv6. You can put it back at Listen 80. How is the vhost/default vhost configured? Aug 24, 2017 at 14:43
  • Check you apache logs for any issues relating to listening on the ip4 address, Aug 24, 2017 at 14:44
  • @JohanMyréen I tried using your suggestion, but the result is unchanged. Raman, there are no specific logs generated related to IPv4. Surprisingly, SSH server is running and it is listening on IPv4 and IPv6 port 22. When tried with Listen in httpd.conf, the netstat showed tcp entry as tcp 0 0* LISTEN but still the port 80 was not accessible from remote hosts.
    – amol
    Aug 25, 2017 at 6:10
  • Try if the connection succeeds from the local host using the non-localhost IP address. If it is ok, and nothing else that you have tried works, I suspect the problem lies elsewhere (firrewall, etc.) Listening on :::80 should not be a problem, since normally a socket listening on IPv6 also accepts IPv4 connections, unless disabled with bindv6only=1. Aug 25, 2017 at 8:10

2 Answers 2

assiduus@localhost:~/httpd-2.4.34$ ./configure --help | grep IPv6
--enable-v4-mapped      Allow IPv6 sockets to handle IPv4 connections

This is enabled by default when you compile Apache httpd from source. If you used your distribution binary package then apparently this option is enabled.


Use something similar to this configuration:

<VirtualHost *:80>
   ServerName www.domain.com
   ServerAlias domain.com

   DocumentRoot /path/to/your/webroot/


The ":80" allows your web server to listen on all ip address on port 80; however this will not take effect until this newly created virtualhost configuration file is enabled and web server is restarted.

Enable your new virtualhost configuration:

a2ensite domain.com.conf

Restart the webserver

service apache2 restart

To verify that web server listens on both ipv4 and ipv6, check with:

netstat -plunt |grep ":80"

Let me know if this help :)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .