I am getting this error when I try to start Apache in Ubuntu.
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
Action 'start' failed.
I have this in my ports.conf
NameVirtualHost *:80
Listen 80
This is my vhost file
<VirtualHost *:80>
ServerAdmin example@example.com
ServerName rails.server.com
# ServerAlias
DocumentRoot /var/www/sample_app/current/public
ErrorLog /var/www/sample_app/error.log
RailsEnv production
<Directory "/var/www/sample_app/current/public">
Options Indexes FollowSymLinks MultiViews
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
What am I missing?
This is due to port 80 is shifted used by other service.
Check any service is using 80 still
and restart the server
Make sure that you don't have the command
Listen 80
in more than one place.In my case, I was getting the same error and the reason was that this command was both in ports.conf and sites-enabled/000-default.
In my case it was nginx ('cause I have it on my server).
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:
Open
/etc/apache2/ports.conf
with any text editor and change the value of the entryListen 80
to the desired port (e.g.Listen 8080
).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>
).This would return the following:
Then run the following command:
(1047 - pid no)
(the pid that appears on your particular instance.)
Restart Apache.
Reference to Ubuntu Forums.
Except the solution find process running on :80 and kill, then start again,
This error might have if you have multiple "Listen" entries in apache conf file or in any .conf files Included in apache conf file. Hope this helps to someone..!!