Ubuntu error with apache: (98)Address already in use

netstat -ltnp | grep :80

This would return the following:

tcp6 0 0 :::80 :::* LISTEN 1047/apache2

Then run the following command:

sudo kill -9 1047

(1047 - pid no)

(the pid that appears on your particular instance.)

Restart Apache.

sudo service apache2 restart

Reference to Ubuntu Forums.


It seems port 80 is already taken. Use another port or try netstat (grep the result to select only the row with value 80 in it), ps and kill to see what application occupies the port and shut it down.


In all cases killing the process may not work, as the process using the port 80 will get restarted and doesn't allow to use the port. So what can be done is to change the port for apache, if that doesn't matter.

Two things are to be changed for that:

  1. Open /etc/apache2/ports.conf with any text editor and change the value of the entry Listen 80 to the desired port (e.g. Listen 8080).

  2. Change the entry for <virtualhost 80> to the same port number you gave in the /etc/apache2/ports.conf file in /etc/apache2/sites-enabled/000-default (e.g. <virtualhost 8080>).