Apache – Fixing Undefined Config Variable on Ubuntu

apache-2.2Ubuntu

I installed apache2 on ubuntu 13.10.
If I try to restart it using

sudo /etc/init.d/apache2 restart

I get this message:

AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message

So I read that I should edit my httpd.conf file. But, since I can't find it in /etc/apache2/ folder, I tried to locate it using this command:

/usr/sbin/apache2 -V

But the output I get is this:

[Fri Nov 29 17:35:43.942472 2013] [core:warn] [pid 14655] AH00111: Config variable ${APACHE_LOCK_DIR} is not defined
[Fri Nov 29 17:35:43.942560 2013] [core:warn] [pid 14655] AH00111: Config variable ${APACHE_PID_FILE} is not defined
[Fri Nov 29 17:35:43.942602 2013] [core:warn] [pid 14655] AH00111: Config variable ${APACHE_RUN_USER} is not defined
[Fri Nov 29 17:35:43.942613 2013] [core:warn] [pid 14655] AH00111: Config variable ${APACHE_RUN_GROUP} is not defined
[Fri Nov 29 17:35:43.942627 2013] [core:warn] [pid 14655] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Fri Nov 29 17:35:43.947913 2013] [core:warn] [pid 14655] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Fri Nov 29 17:35:43.948051 2013] [core:warn] [pid 14655] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Fri Nov 29 17:35:43.948075 2013] [core:warn] [pid 14655] AH00111: Config variable ${APACHE_LOG_DIR} is not defined

AH00526: Syntax error on line 74 of /etc/apache2/apache2.conf:
Invalid Mutex directory in argument file:${APACHE_LOCK_DIR}

Line 74 of /etc/apache2/apache2.conf is this:

Mutex file:${APACHE_LOCK_DIR} default

I gave a look at my /etc/apache2/envvar file, but I don't know what to do with it.

What should I do?

Best Answer

[Fri Nov 29 17:35:43.942472 2013] [core:warn] [pid 14655] AH00111: Config variable ${APACHE_LOCK_DIR} is not defined

This message is displayed because you directly executed the apache2 binary. In Ubuntu/Debian the apache config relies on the envvar file which is only activated.

If you start apache with the init script or apachectl.

Your original problem is that you have no a proper hostname (fqdn) for your machine.

If you can't change it, change the ServerName variable in /etc/apache2/apache2.conf to localhost or your prefered FQDN.