Apache fails to start, Address already in use (but not really)
Make sure you are not declaring Listen 80
twice in .conf files.
For example, you might have it both in ports.conf
and inn sites-enabled/www.conf
.
To find out, use: grep -ri listen /etc/apache2
Keep Listen 80
in just a single place.
Answering the way I solved out this issue. May be helpful to someone in future.
Try netstat -ltnp | grep :80
This would return something like
tcp6 0 0 :::80 :::* LISTEN 1047/apache2
Then run
sudo kill -9 1047
Where 1047 is the pid of the program running on port 80.You can replace the pid that you obtained from netstat
I had a Nginx server listening on my AWS EC2 server, I think it got configured when I was building the EC2, hence was I getting Address already in use error. So I stopped the service and started the Apache2 service:
sudo service nginx stop
sudo service apache2 start