[aman@aman-Inspiron-1440:~$ apache2
[Mon Apr 21 17:36:38.019213 2014] [core:warn] [pid 4134] AH00111: Config variable ${APACHE_LOCK_DIR} is not defined
[Mon Apr 21 17:36:38.019345 2014] [core:warn] [pid 4134] AH00111: Config variable ${APACHE_PID_FILE} is not defined
[Mon Apr 21 17:36:38.019370 2014] [core:warn] [pid 4134] AH00111: Config variable ${APACHE_RUN_USER} is not defined
[Mon Apr 21 17:36:38.019385 2014] [core:warn] [pid 4134] AH00111: Config variable ${APACHE_RUN_GROUP} is not defined
[Mon Apr 21 17:36:38.019414 2014] [core:warn] [pid 4134] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Mon Apr 21 17:36:38.028756 2014] [core:warn] [pid 4134] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Mon Apr 21 17:36:38.029032 2014] [core:warn] [pid 4134] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Mon Apr 21 17:36:38.029056 2014] [core:warn] [pid 4134] 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}
This is the content of /etc/apache2/apache2.conf
file.
I had this problem even though apache was working for me. I simply wanted to do a quick
to find the value of
SERVER_CONFIG_FILE
. Because that's not the way to start apache2 any more it fails with the errors the OP posts. A quick and dirty workaround is simply to set the envvars that are missing first:This sets the APACHE_LOCK_DIR variable and all is well (
-D SERVER_CONFIG_FILE="apache2.conf"
).I had this problem : The cause is in the file
where the root have changed:
before upgrade =
/var/www
after upgrade =
/var/www/html
So edit to modify this file
And restart apache
Symptoms and solution
In many Q&A web sites or forums, people confuse symptoms and actual causes. I just upgraded a ubuntu server from 13.10 to 14.04.1 and ran into the exact same symptoms described by the OP, including:
1- apache apparently not working. 2- apache configuration variable undefined. 3- the syntax error mentioned by the OP.
The problem is that not all of these symptoms are actually germane to the actual problem and they only serve as a distraction to those who try their best to help.
Different root problems may cause administrators to come to sites like this one with roughly the same description: "I upgraded the OS and now apache is not working..."
One specific cause
Having all the exact same apparent symptoms as the OP, I was attracted to this question. Unfortunately, the only answer that contained a valid hint to the real root cause of my problem was downvoted (-1), posted by user1469291 with a rep of 1!! So I searched further other web sites until I found a clear explanation of the problem (and thereby of the solution).
The solution that follows may not solve the OP's real problem, but I'm sure that it'll help others who may be attracted to this question for the same reasons as I was.
/etc/apache2/apache2.conf contains:
which means that only site configuration files in /etc/apache2/sites-enabled/ ending in .conf will get loaded. Older symlink in that directory will be ignored.
It used to be simply sites-enabled/*. That's why all my virtual host configuration files that I simply named ww1.example.com, ww2.example.com, etc, used to work but suddenly and initially inexplicably stopped working after the upgrade.
So, either change the directive above and reload apache, or, like I did, manually remove all the older symlinks in sites-enabled/, rename all the files in sites-available/ to add the suffix .conf and then re-enabled each site individually.
In addition, the default directive in apache.conf are stricter:
So if you host your virtual sites in /home/user/somewhere, make sure to override the directive appropriately.
Looking closely at your problem, you are just running
apache2
. To start apache in Ubuntu, run the following command:Apache configuration are split into multiple files, one of those files are environment variables. When you are running just
apache2
, these variables are not set.The apache2ctl script will load the variables (and do some other stuff as well when needed) before starting apache with
apache2 -k start
.Edit the configuration:
sudo leafpad /etc/apache2/apache2.conf
:or remove file.
augustin's answer worked for me when all my virtual hosts disappeared following a server upgrade from 12.04 LTS to 14.04 LTS. I would upvote it if I had the reputation to do so.
The following command will add the
.conf
suffix to all symlinks in/etc/apache2/sites-enabled
that don't already have it:In addition, there has been a change from using the
Allow from
/Deny from
syntax toRequire
in the mod_authz_host module (here is the link for the 2.2 documentation).The following command will edit the common usage of
Order allow, deny
followed byAllow from all
to beRequire all granted
instead:In fact, the docroot does change between precise and trusty from /var/www to /var/www/html. It is poor that the do-release-upgrade script does not regress the docroot back.
A) Either is valid, but html is more conventional. CentOS is influential in this regard. The "it works" page is more mature now too.
B) You do not have to use /var/www/html, but if you do...
C) And it may be easier to build from the ground up and migrate.
D) This symptom will occur if you "sudo apache2 -k graceful" out of the box on Trusty, upgrade or not due to envvars not being in scope ?. Use "sudo apache2ctl start/stop/restart" instead.
In my case:
html
subfolder at/var/www/
already existed but still I was getting the error:AH00526: Syntax error on line 74 of /etc/apache2/apache2.conf
/home/{user}/sites/
instead of the default/var/www/html
apache2 -v
)How I solved the problem in five easy steps:
In
/etc/apache2/apache2.conf
I added the following after line 169:I made sure my Virtual Host configuration named
website.conf
at/etc/apache2/sites-available
was copied from the default000-default.conf
, and looked like:I reloaded my site (
sudo a2dissite website && sudo a2ensite website
) and my server and the initial error was gone. WOOHOO! But a new one emerged: "AH00035: access to / denied (filesystem path '/home/{user}/sites') because search permissions are missing on a component of the path". This I solved in step 4.The new problem was due to permissions, so I just set each of the directories leading up to the
website
folder tochmod 755
. Every single one! Thehome
folder, the {user} folder, the sites folder, and even my website folderAfter refreshing my browser at
website.dev
everything loaded fine!P.S. I had already setup
website.dev
in my/etc/hosts
file.Bonus Tip: To check permissions of a particular folder you can use the command
stat -c %a /path/to/file/or/folder
. To check permissions of every part of a directory usenamei -m /path/to/final/folder
.