I am trying to start apache using the following command:

sudo -E -u [my_username] /usr/sbin/apachectl -f conf/httpd.conf

I get the following error:

no listening sockets available, shutting down
Unable to open logs

The only 2 changes I have made to httpd.conf are as below:

Listen [IP address]:8081
<VirtualHost [IP address]:8081>
    RewriteEngine on
    RewriteRule ^(.*) http://[IP address]$1 [P]

Note: I am trying to get apache configured on a remote server so I cannot use localhost

Can anyone guide me as to where I maybe going wrong?

  • httpd.conf is not used anymore, so which version of Ubuntu are you using? (an older one, I assume). Is apache or something else already using the port? Use sudo netstat -plnt to observe. May 27, 2015 at 15:29
  • It is listening on 8080 ----> tcp 0 0* LISTEN - but I used port 8081 and not 8080 May 27, 2015 at 15:34

1 Answer 1


It could be your firewall causing the problem. Try opening port 8081 with iptables like this:

sudo iptables -A INPUT -p tcp --dport 8081 -j ACCEPT

Or if you're using UFW:

sudo ufw allow 8081
  • I don't have sudo on the system, I tried the above 2 but permission denied. But if I understand correctly the above commands are to insert the port number into iptable I am trying to access? May 27, 2015 at 15:39
  • Yes exactly, the port number you have apache listening on, is the one you have to open with iptables so traffic can pass through the firewall.
    – krt
    May 27, 2015 at 16:06

You must log in to answer this question.

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