Page 1 of 1

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

Posted: Wed Mar 17, 2010 7:25 pm
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.

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

Posted: Fri Mar 19, 2010 10:53 pm
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.)

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

Posted: Fri Mar 19, 2010 11:41 pm
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.

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

Posted: Sat Mar 20, 2010 3:18 am
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.

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

Posted: Sat Mar 20, 2010 8:01 pm
by mister_v
Starting with the arguments makes it work:

Code: Select all

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