Apache22 Won’t Start in FreeBSD 9

Sometimes you may get issues to start Apache on FreeBSD, in my case FreeBSD 9.1.

How to solve this?

# /usr/local/etc/rc.d/apache22 start
Performing sanity check on apache22 configuration:httpd: apr_sockaddr_info_get() failed for FreeBSD-unixmenhttpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
Syntax OK
Starting apache22.httpd: apr_sockaddr_info_get() failed for FreeBSD-unixmen
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName/usr/local/etc/rc.d/apache22: WARNING: failed to start apache22

The “Could not reliably determine the server’s fully qualified domain name” error can be solved by editing /usr/local/etc/apache22/httpd.conf.

Open this file and set ServerName to localhost:80. After, check the httpd logs.

[Mon Aug 12 11:56:39 2013] [alert] (EAI 8)hostname nor servname provided, or not known: mod_unique_id: unable to find IPv4 address of "FreeBSD-unixmen"
Configuration Failed

The fastest way to get rid of this error is to disable mod_unique. Edit the Apache configuration file and comment LoadModule unique_id_module libexec/apache22/mod_unique_id.so:

# LoadModule unique_id_module libexec/apache22/mod_unique_id.so

Restart Apache again:

# /usr/local/etc/rc.d/apache22 start
Performing sanity check on apache22 configuration:
Syntax OK
Starting apache22.

apache2--