Httpd – can’t access apache via custom port

apache-2.2httpdport

I have configured apache to Listen on the port 80 and 4986

I can access it on virtualhost on port 80
but can't access it on port 4986

I have tried lsof -i:4986 :

apache2 26669 www-data    6u  IPv6 46697578      0t0  TCP *:4986 (LISTEN)
apache2 26670 www-data    6u  IPv6 46697578      0t0  TCP *:4986 (LISTEN)
apache2 26739 www-data    6u  IPv6 46697578      0t0  TCP *:4986 (LISTEN)
apache2 26741 www-data    6u  IPv6 46697578      0t0  TCP *:4986 (LISTEN)
apache2 26742 www-data    6u  IPv6 46697578      0t0  TCP *:4986 (LISTEN)
apache2 26837 www-data    6u  IPv6 46697578      0t0  TCP *:4986 (LISTEN)
apache2 26939 www-data    6u  IPv6 46697578      0t0  TCP *:4986 (LISTEN)
apache2 26940 www-data    6u  IPv6 46697578      0t0  TCP *:4986 (LISTEN)
apache2 26941 www-data    6u  IPv6 46697578      0t0  TCP *:4986 (LISTEN)
apache2 26952 www-data    6u  IPv6 46697578      0t0  TCP *:4986 (LISTEN)

the port is listened

but when I'm trying nmap -v -A localhost

Scanning localhost (127.0.0.1) [1000 ports]
Discovered open port 110/tcp on 127.0.0.1
Discovered open port 143/tcp on 127.0.0.1
Discovered open port 993/tcp on 127.0.0.1
Discovered open port 53/tcp on 127.0.0.1
Discovered open port 80/tcp on 127.0.0.1
Discovered open port 995/tcp on 127.0.0.1
Discovered open port 25/tcp on 127.0.0.1
Discovered open port 22/tcp on 127.0.0.1
Discovered open port 1723/tcp on 127.0.0.1
Discovered open port 21/tcp on 127.0.0.1
Discovered open port 10000/tcp on 127.0.0.1
Discovered open port 9091/tcp on 127.0.0.1
Discovered open port 6502/tcp on 127.0.0.1
Discovered open port 6969/tcp on 127.0.0.1
Discovered open port 8333/tcp on 127.0.0.1

the port isn't discovered

I have also to add this on my iptables :

iptables -t filter -A INPUT -p tcp --dport 4986 -j ACCEPT
iptables -t filter -A INPUT -p udp --dport 4986 -j ACCEPT
iptables -t filter -A OUTPUT -p tcp --dport 4986 -j ACCEPT
iptables -t filter -A OUTPUT -p udp --dport 4986 -j ACCEPT

but not working

any idea of what is going wrong ?

Best Answer

It appears Apache is listening on port 4986 on IPv6 only (unless you suppressed the output).

You also append IPTables rules to the existing ones so if there was a drop rule before that you wont be able to access it.

Regards