# Failed to start apache22



## adripillo (Jul 10, 2013)

Hello again, sorry for posting a lot recently. Since I am trying to learn a lot about hosting I found myself with some problems that I cannot handle so I come here once again.

I was trying to start apache22 and got this*:*

```
# service apache22 start
Performing sanity check on apache22 configuration:
Syntax OK
Starting apache22.
/usr/local/etc/rc.d/apache22: WARNING: failed to start apache22
```

So I google about it and tried some solution that did not work, after seeing the log _I_ got this:

```
# cat /var/log/httpd-error.log
[Wed Jul 10 09:41:48 2013] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Wed Jul 10 09:41:48 2013] [alert] (EAI 8)hostname nor servname provided, or not known: mod_unique_id: unable to find IPv4 address of "USH1"
Configuration Failed
[Wed Jul 10 09:47:46 2013] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Wed Jul 10 09:47:46 2013] [alert] (EAI 8)hostname nor servname provided, or not known: mod_unique_id: unable to find IPv4 address of "USH1"
Configuration Failed
[Wed Jul 10 09:47:56 2013] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Wed Jul 10 09:47:56 2013] [alert] (EAI 8)hostname nor servname provided, or not known: mod_unique_id: unable to find IPv4 address of "USH1"
Configuration Failed
[Wed Jul 10 09:50:02 2013] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Wed Jul 10 09:50:03 2013] [notice] Digest: generating secret for digest authentication ...
[Wed Jul 10 09:50:03 2013] [notice] Digest: done
[Wed Jul 10 09:50:04 2013] [notice] Apache/2.2.24 (FreeBSD) mod_ssl/2.2.24 OpenSSL/0.9.8x DAV/2 configured -- resuming normal operations
[Wed Jul 10 09:50:18 2013] [error] [client 127.0.0.1] File does not exist: /usr/local/www/apache22/data/favicon.ico
[Wed Jul 10 10:20:48 2013] [error] [client 127.0.0.1] File does not exist: /usr/local/www/apache22/data/favicon.ico, referer: http://127.0.0.1/
[Wed Jul 10 12:26:40 2013] [notice] caught SIGTERM, shutting down
(2)No such file or directory: httpd: could not open error log file /var/log/apache2/error-cuculac.log.
Unable to open logs
(2)No such file or directory: httpd: could not open error log file /var/log/apache2/error-cuculac.log.
Unable to open logs
(2)No such file or directory: httpd: could not open error log file /var/log/apache2/error-cuculac.log.
Unable to open logs
(2)No such file or directory: httpd: could not open error log file /var/log/apache2/error-cuculac.log.
Unable to open logs
(2)No such file or directory: httpd: could not open error log file /var/log/apache2/error-cuculac.log.
Unable to open logs
(2)No such file or directory: httpd: could not open error log file /var/log/apache2/error-cuculac.log.
Unable to open logs
(2)No such file or directory: httpd: could not open error log file /var/log/apache2/error-cuculac.log.
Unable to open logs
(2)No such file or directory: httpd: could not open error log file /var/log/apache2/error-cuculac.log.
Unable to open logs
```

Any kind of help is welcome as always.


----------



## ShelLuser (Jul 10, 2013)

It seems to me that you have two issues to fix:



			
				adripillo said:
			
		

> ```
> [B]---<CUT; for easier reading[/B]
> 
> [Wed Jul 10 09:41:48 2013] [alert] (EAI 8)hostname nor servname provided, or not known: mod_unique_id: unable to find IPv4 address of "USH1"
> ...


The first thing to look out for is the hostname or servername. Every website you configure should have a ServerName entry which basically specifies its name. It would seem that your setup is missing that entry.

That would become an even bigger problem if you're going to use multiple websites on a single server; the normal way to do that is by using 'Name based virtual hosts' which basically means so much as: running several websites on one server and separating between them by their name.

Needless to say; but if a name is missing then that's going to become a problem.

However, I also noticed an entry regarding /usr/local/www/apache22/data/favicon.ico up there, which is basically the location for the default website. That is of course another thing you could do: simply change httpd.conf and modify everything to suit your own setup; if you're only going to use one website then this could be a liable option.

Alas; as to the second problem; the logfile: does /var/log/apache2 actually exist? By default Apache puts its logfiles directly into /var/log, so if you want to extend on that you'll have to create the directory /var/log/apache2 yourself first.

Hope this gives you some ideas.


----------



## NewGuy (Jul 10, 2013)

Sometimes Apache will refuse to start if your computer's hostname does not look like a full domain name. For example, I've had Apache refuse to start if my computer's hostname is "zak", but it will start if I change the hostname to "zak.localdomain". Maybe take a look in the file /etc/hostname as see what your hostname is.


----------



## adripillo (Jul 10, 2013)

Thanks to both, I will let you know how it was as soon as I arrive home.


----------



## adripillo (Jul 11, 2013)

Just finished to change all that and now *A*pache started well, but when I go to Opera and type 127.0.0.1 or my hostname it says access is forbidden. This is like building a castle, after this fin*i*sh*ed* working I think I am going to make a guide. Any idea of why is giving me forbidden? *?.* _[ <<- stop doing this. -- Mod. ]_


----------



## SirDice (Jul 11, 2013)

Probably because it cannot find a file that's named in DirectoryIndex and directory browsing has been turned off.


----------



## adripillo (Jul 11, 2013)

SirDice said:
			
		

> Probably because it cannot find a file that's named in DirectoryIndex and directory browsing has been turned off.



That's because the guide says to add 

```
<IfModule mod_dir.c>
    DirectoryIndex index.html index.htm index.shtml index.cgi index.php index.php3 index.pl index.xhtml
</IfModule>
```

I added it inside httpd.conf at the end, but it seems it's not taking it and I never disabled directory browsing, so it should be enabled by default.


----------

