3
# service apache2 start
 * Starting web server apache2                                                                                                             
 AH00112: Warning: DocumentRoot [<removed>/public_html] does not exist
 * 
 * The apache2 instance did not start within 20 seconds. Please read the log files to discover problems

/var/apache2/error.log:

[Sun Mar 19 15:15:41.234542 2017] [ssl:warn] [pid 6491] AH02292: Init: Name-based SSL virtual hosts only work for clients with TLS server name indication support (RFC 4366)
[Sun Mar 19 15:15:41.272641 2017] [ssl:warn] [pid 6492] AH02292: Init: Name-based SSL virtual hosts only work for clients with TLS server name indication support (RFC 4366)
[Sun Mar 19 15:15:41.272744 2017] [core:error] [pid 6492] (13)Permission denied: AH00099: could not create /var/run/apache2/apache2.pid
[Sun Mar 19 15:15:41.272765 2017] [core:error] [pid 6492] AH00100: apache2: could not log pid to file /var/run/apache2/apache2.pid

I've just upgraded Ubuntu (Server) from 12.04 LTS to 14.04 LTS, and thus Apache from 2.2 to 2.4. I've updated much of the configuration, but for some reason Apache seems not to be able to write its own pid file, despite my having tried all combinations of permissions that would make any sense:

drwxrwxr-x  2 root www-data  40 Mar 19 14:55 /var/run/apache2

Apache isn't chrooting, and SELinux is disabled. I've logged in as www-data and tested that it has permissions to create the pid file, and it does.

The line about the document root not existing is I think the same problem, as www-data has access to it through acls. I also have turned off a Mutex directive which caused Apache to complain about not being able to create a mutex file, in exactly the same way as this pid file, but a completely different place.

I can't think of anything that could be causing this, and would appreciate some help.

  • Are you in the apache group? – George Udosen Mar 19 '17 at 16:57
  • There is no apache group. www-data is in the www-data group, if that's what you mean. – gandaliter Mar 20 '17 at 0:10
  • I know the apache group is www-data, are u in that group? – George Udosen Mar 20 '17 at 5:28
  • Sorry. The user www-data is, and root isn't. My own user isn't. I'm just confused because I'm not sure what that would change. – gandaliter Mar 20 '17 at 8:31
  • Please add yourself to the www-data group, sudo gpasswd -a <your-username> www-data and see if it changes anything. I operate with me in groupwww-data – George Udosen Mar 20 '17 at 8:34
0

I can't comment or I would add this as a comment instead of an answer, but my /var/run/apache2 is owned by root

drwxr-xr-x  2 root  root    60 Mar 18 18:50 apache2

make sure the /var/www has the right permissions. I'm on 16.04 now but I remember at one point all my apache files were in the /var/www folder whereas now they're in /var/www/html so ymmv

drwxr-xr-x  3 root root   4096 Mar  7 00:22 www


drwxr-xr-x  3 www-data www-data 4096 Mar 11 21:07 html

if you have an html folder it may be an idea to run

sudo chown -R www-data:www-data /var/www/html
  • It's quite a complex setup with a lot of virtual hosts. The permissions haven't changed since before the upgrade, and they always worked then. They're all readable by Apache. – gandaliter Mar 19 '17 at 15:41
  • When I upgraded, at some part of the process my apache documentroot changed from /var/www to /var/www/html. It may be different for you but your intial output mentions that it can't find the document root. I followed a few guides so can't be sure of what eventually fixed it but if a document root problem is present have you checked the sitesenabled settings to ensure the paths are correct? digitalocean.com/community/tutorials/…. – Will Mar 19 '17 at 15:52
  • Thanks for your suggestions. I've removed the config that had the confused virtual host, and when I run apachectl configtest it reports no problems now, but the original problem persists. – gandaliter Mar 19 '17 at 16:08
  • Maybe this thread might help now? askubuntu.com/questions/431925/… – Will Mar 19 '17 at 16:13
  • Alas not - there are no other instances of apache running, and no pid files to clash with. I created one, and it clashed, and deleted it, and it's back to the normal problem. – gandaliter Mar 19 '17 at 16:15
0

The issue has now been fixed. It turned out it was something to do with Apparmor not allowing the creation of the pid file, even though it was explicitly allowed in the config file. I'll post more details when I've worked out what was going on.

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.