Solved: Apache won't start: no listening sockets available

Questions related to the Apache server
Post Reply
Peter_w
Posts: 28
Joined: Tue Aug 19, 2008 9:28 am

Solved: Apache won't start: no listening sockets available

Post by Peter_w »

I have a weird problem.

I have apache 2.2.14 installed and it worked fine.
I did a restart of the server and it doesn't want to start!

I get the following error message:

Code: Select all

apache2 -k start
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
no listening sockets available, shutting down
Unable to open logs
I checked apache is not running;
I did even a "zap"

Code: Select all

/etc/init.d/apache2 zap
And why can't it open the logs?
The user and groups are both apache.

Any help please.
chris
Site Admin
Posts: 194
Joined: Mon Jul 21, 2008 9:52 am

Re: Apache won't start: no listening sockets available

Post by chris »

Sounds like the Listing ports aren't set.

Check in /etc/apache2/httpd.conf
for the line:

Code: Select all

Listen 80
(Can be any other port, that isn't used by another service.)
mister_v
Posts: 188
Joined: Thu Mar 04, 2010 9:19 pm

Re: Apache won't start: no listening sockets available

Post by mister_v »

I added the line:

Code: Select all

Listen 80
And the server starts without error:

Code: Select all

apache2 -k start
But when I try accessing my site I get:

Code: Select all

403 Forbidden
You don't have permission to access / on this server.
Apache Server at localhost Port 80
In my error log I get:
tail /var/log/apache2/error_log

Code: Select all

 [error] [client 127.0.0.1] client denied by server configuration: /usr/htdocs
I never use /usr/htdocs anywhere in my config-files.
chris
Site Admin
Posts: 194
Joined: Mon Jul 21, 2008 9:52 am

Re: Apache won't start: no listening sockets available

Post by chris »

I had this problem once.

Apparently, /usr/htdocs is a default directory build in apache.
that is way you can't find it in the config files.

Your are probably using virtual host, but haven't included it your command to launch apache.
It should look something like this:

Code: Select all

apache2 -D DEFAULT_VHOST -D PHP5 -k start
if you have several virtual hosts:

Code: Select all

apache2 -D DEFAULT_VHOST -D VIRTUALHOST2 -D PHP5 -k start
The name of the virtual host is the name you give as

Code: Select all

<IfDefine DEFAULT_VHOST>
in the file of your virtual host:

Code: Select all

/etc/apache2/vhosts.d/00_default_vhost.conf

Usually the Listen -line is also written in the virtual host-file. so it is not needed in httpd.conf .

You can write the arguments in:
/etc/conf.d/apache2

Code: Select all

APACHE2_OPTS="-D DEFAULT_VHOST -D PHP5"
Then you should be able to launch everything with the following command:

Code: Select all

/etc/init.d/apache2 start
hopes this helps.
mister_v
Posts: 188
Joined: Thu Mar 04, 2010 9:19 pm

Re: Apache won't start: no listening sockets available

Post by mister_v »

Starting with the arguments makes it work:

Code: Select all

apache2 -D DEFAULT_VHOST -D PHP5 -k start
Thanks,
Post Reply