# Apache2 error

## chieuphu

I got this error when starting apache

```
/etc/init.d/apache2 restart                                                                                                            /etc/conf.d

 * Re-caching dependency info (mtimes differ)...

 * Starting apache2...

(98)Address already in use: make_sock: could not bind to address 0.0.0.0:443

no listening sockets available, shutting down

Unable to open logs 
```

Please help

----------

## savage

how about the last few (~30) lines of /var/log/apache/error_log ?

Also, do you mean to be trying to listen on the SSL port?  (that's what 443 is) - if you do, did you create yourself a key and sign it?

----------

## chieuphu

 *savage wrote:*   

> how about the last few (~30) lines of /var/log/apache/error_log ?
> 
> Also, do you mean to be trying to listen on the SSL port?  (that's what 443 is) - if you do, did you create yourself a key and sign it?

 

Yes I do want it to listen to SSL and do have a key and signed it.

```
[Thu Jun 01 12:58:32 2006] [error] [client 130.207.128.120] File does not exist: /home/httpd/htdocs/password/favicon.ico

[Thu Jun 01 12:58:33 2006] [error] [client 130.207.128.120] File does not exist: /home/httpd/htdocs/password/favicon.ico

[Thu Jun 01 12:59:14 2006] [notice] caught SIGTERM, shutting down

[Thu Jun 01 12:59:15 2006] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec2)

[Thu Jun 01 12:59:15 2006] [warn] RSA server certificate CommonName (CN) `password' does NOT match server name!?

[Thu Jun 01 12:59:15 2006] [warn] RSA server certificate CommonName (CN) `webmail' does NOT match server name!?

[Thu Jun 01 12:59:15 2006] [notice] Digest: generating secret for digest authentication ...

[Thu Jun 01 12:59:15 2006] [notice] Digest: done

[Thu Jun 01 12:59:16 2006] [warn] RSA server certificate CommonName (CN) `password' does NOT match server name!?

[Thu Jun 01 12:59:16 2006] [warn] RSA server certificate CommonName (CN) `webmail' does NOT match server name!?

[Thu Jun 01 12:59:16 2006] [notice] Apache configured -- resuming normal operations

[Thu Jun 01 12:59:18 2006] [error] [client 130.207.128.120] Directory index forbidden by rule: /home/httpd/htdocs/password/

[Thu Jun 01 13:08:51 2006] [error] [client 130.207.128.120] Directory index forbidden by rule: /home/httpd/htdocs/password/

[Thu Jun 01 13:10:52 2006] [error] [client 130.207.128.120] Directory index forbidden by rule: /home/httpd/htdocs/password/

[Thu Jun 01 13:47:47 2006] [error] [client 130.207.128.120] Directory index forbidden by rule: /home/httpd/htdocs/password/

[Thu Jun 01 14:41:11 2006] [notice] caught SIGTERM, shutting down

[Thu Jun 01 14:41:13 2006] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec2)

[Thu Jun 01 14:41:14 2006] [warn] RSA server certificate CommonName (CN) `password' does NOT match server name!?

[Thu Jun 01 14:41:14 2006] [warn] RSA server certificate CommonName (CN) `webmail' does NOT match server name!?

[Thu Jun 01 14:41:14 2006] [notice] Digest: generating secret for digest authentication ...

[Thu Jun 01 14:41:14 2006] [notice] Digest: done

[Thu Jun 01 14:41:14 2006] [warn] RSA server certificate CommonName (CN) `password' does NOT match server name!?

[Thu Jun 01 14:41:14 2006] [warn] RSA server certificate CommonName (CN) `webmail' does NOT match server name!?

[Thu Jun 01 14:41:14 2006] [notice] Apache configured -- resuming normal operations

[Thu Jun 01 14:41:29 2006] [error] [client 130.207.128.120] Directory index forbidden by rule: /home/httpd/htdocs/password/

[Thu Jun 01 15:17:15 2006] [notice] caught SIGTERM, shutting down

[Thu Jun 01 15:17:16 2006] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec2)

[Thu Jun 01 15:17:16 2006] [warn] RSA server certificate CommonName (CN) `password' does NOT match server name!?

[Thu Jun 01 15:17:16 2006] [warn] RSA server certificate CommonName (CN) `webmail' does NOT match server name!?

[Thu Jun 01 15:17:17 2006] [notice] Digest: generating secret for digest authentication ...

```

----------

## savage

what about the output from

```

netstat -natp | grep LISTEN

```

It sounds like you have an httpd daemon running on :443 already.  This command will show us what services you have running, and if one has port 443 open, you will be able to see what pid it has.

----------

## chieuphu

 *savage wrote:*   

> what about the output from
> 
> ```
> 
> netstat -natp | grep LISTEN
> ...

 

```

netstat -natp | grep LISTEN                                                                                                 /var/log/apache2

tcp        0      0 0.0.0.0:32769           0.0.0.0:*               LISTEN      -                   

tcp        0      0 0.0.0.0:2049            0.0.0.0:*               LISTEN      -                   

tcp        0      0 0.0.0.0:993             0.0.0.0:*               LISTEN      1562/               

tcp        0      0 0.0.0.0:995             0.0.0.0:*               LISTEN      1562/               

tcp        0      0 0.0.0.0:680             0.0.0.0:*               LISTEN      1770/rpc.statd      

tcp        0      0 0.0.0.0:110             0.0.0.0:*               LISTEN      1562/               

tcp        0      0 127.0.0.1:783           0.0.0.0:*               LISTEN      1936/spamd.pid -aqx 

tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      1758/               

tcp        0      0 0.0.0.0:143             0.0.0.0:*               LISTEN      1562/               

tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      17441/apache2       

tcp        0      0 0.0.0.0:2000            0.0.0.0:*               LISTEN      1562/               

tcp        0      0 0.0.0.0:2004            0.0.0.0:*               LISTEN      1562/               

tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      2043/sshd           

tcp        0      0 0.0.0.0:694             0.0.0.0:*               LISTEN      1787/rpc.mountd     

tcp        0      0 0.0.0.0:631             0.0.0.0:*               LISTEN      1294/cupsd          

tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN      1989/               

tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN      17441/apache2  

```

when I do ps -ef | grep apache, I see it running. So I kill that process and restart apache ok. But when I stop it, I have this error and the problem re-occur.

```
 ps -ef | grep apache                                                                                                             /var/log/apache2

root     17143     1  0 16:17 ?        00:00:00 /usr/sbin/apache2 -D DEFAULT_VHOST -D SSL -D PERL -D PHP5 -d /usr/lib/apache2 -f /etc/apache2/httpd.conf -k start

17262 16720  0 16:19 pts/1    00:00:00 egrep apache

% sudo kill -9 17143                                                                                                               /var/log/apache2

% /etc/init.d/syslog-ng restart                                                                                                    /var/log/apache2

 * ERROR: must be root to run init scripts

% sudo /etc/init.d/apache2 start                                                                                                   /var/log/apache2

 * Starting apache2...                                                                                                                                    [ ok ]

% sudo /etc/init.d/apache2 stop                                                                                                    /var/log/apache2

 * Stopping apache2...

httpd (no pid file) not running                                                                                                                           [ ok ]

% sudo /etc/init.d/apache2 start                                                                                                   /var/log/apache2

 * Starting apache2...

(98)Address already in use: make_sock: could not bind to address 0.0.0.0:443

no listening sockets available, shutting down

Unable to open logs                
```

When I start apache, my webpage does not seem to load with this error.

----------

## savage

for the fun of it, what happens if you use

```
su -

/etc/init.d/apache2 stop

```

instead of sudo?

Try starting and stopping it inside a shell with 'su -' instead of sudo.  (once you have killed it again)

Another thing to try is apachectl to stop it instead of kill.

interestingly enough, it is not letting apache start the second time  because it is already running  :Smile: 

----------

## chieuphu

 *savage wrote:*   

> for the fun of it, what happens if you use
> 
> ```
> su -
> 
> ...

 

I try that. Same thing happens.

The funny things is that now my webpage does not load any more. On the browser, it does not say page not found or any thing. It stucks in loading till time out.

----------

## savage

okay - when you say you cannot access your home page, and you say that it times out, I assume you are using some name for your computer, and it is not resolving.

Do you have a static ip address?  If you do, does your /etc/hosts file point the name of your box to your ip address?

can you ping the hostname (whatever you use) to access the website?

if you all of the above work, run the `netstat -nat` command again, and verify that your box has port 80 open.  If it does, try `telnet localhost 80` and type "GET / http/1.0" (without the quotes), and see if you get something as a response.  If you do, try going to the _non_secure website in a browser.

I was noticing in your error logs  that it was trying to access "/home/httpd/htdocs/password/", but it has been forbidden in your apache config file.

Let's first figure out if name resolution is working on your box, then we will troubleshoot your apache.

----------

## chieuphu

 *savage wrote:*   

> okay - when you say you cannot access your home page, and you say that it times out, I assume you are using some name for your computer, and it is not resolving.
> 
> Do you have a static ip address?  If you do, does your /etc/hosts file point the name of your box to your ip address?
> 
> can you ping the hostname (whatever you use) to access the website?
> ...

 

I restart the box and it works. Dont know what happened. Thanks very much for your help.  :Smile: 

----------

## savage

marvelous.  Happy to help.

Probably would be a good idea to figure out what happened specifically.  Usually, you don't want things like that happening without you being able to account for it.  Make sure you can account for all of your open ports and running processes.

----------

## kallamej

Moved from Portage & Programming to Networking & Security.

----------

