# apache22 won't start



## cbrace (Sep 19, 2012)

Hi all,

I have just installed www/apache22 on my FreeBSD VPS (hitherto I've always ran lighttpd). For some reason, it won't start, even though the httpd.conf appears to be OK:



> $ sudo /usr/local/etc/rc.d/apache22 onestart
> Performing sanity check on apache22 configuration:
> Syntax OK
> Starting apache22.
> /usr/local/etc/rc.d/apache22: WARNING: failed to start apache22



There is a warning in /var/log/httpd-error.log, but nothing that appears fatal:


```
[Wed Sep 19 13:36:57 2012] [alert] (EAI 8)hostname nor servname provided, or not known: mod_unique_id: unable to find IPv4 address of "tilcara.localdomain"
```

Any ideas what might be going wrong here?

TIA


----------



## SirDice (Sep 19, 2012)

Make sure the hostname and IP address of the host are resolvable.


----------



## cbrace (Sep 19, 2012)

I have two uncommented lines in my /etc/hosts file:

```
::1                     localhost localhost.quilombo.nl
127.0.0.1               localhost localhost.quilombo.nl
```
Is this not enough?


----------



## SirDice (Sep 19, 2012)

localhost is a special name, not your hostname.


----------



## cbrace (Sep 19, 2012)

Hmmm, the only way I get apache to run is to comment out mod_unique_id.so, which hardly seems ideal, but I can't seem to determine the correct hostname entry for my server, if that indeed is the problem.

Never mind, got it working. Setting the hostname in /etc/rc.conf and rebooting fixed things.


----------



## bkouhi (Sep 20, 2012)

I had this problem too and fix it in this way:

`# echo  "ip-address $HOSTNAME" >> /etc/hosts`

Replace _ip-address_ before running this command.


----------



## bkouhi (Sep 20, 2012)

Sorry for double posting. The above command is incorrect. You must run:

`# echo "ip-address $HOST" >> /etc/hosts`

Assume that Apache Listened on 192.168.1.3 so:

`# echo "192.168.1.3 $HOST" >> /etc/hosts`

You can see the complete error message in /var/log/httpd-error.log


```
# tail /var/log/httpd-error.log
...
[Thu Sep 20 16:06:31 2012] [alert] (EAI 8)hostname nor servname provided, or not known:
 mod_unique_id: unable to find IPv4 address of "FreeBSD"
```


----------

