httpd service will not start on boot under CentOS 6
The problem turned out to be that the VM was trying to start the Apache service before Vagrant had mounted the shared folders, and the httpd DocumentRoot was pointing to a non existent directory. I followed these instructions to set up a udev event to wait until the mount occurred before attempting to start httpd.
http://razius.com/articles/launching-services-after-vagrant-mount/
Related videos on Youtube
Zac Crites
Electrical/Computer Engineering Student Marquette University
Updated on September 18, 2022Comments
-
Zac Crites over 1 year
I am having trouble configuring a CentOS 6 Vagrant setup to start the Apache service on boot. I have tried using chkconfig and the OS seems to just ignore it.
When I run
sudo chkconfig --list httpd
, I gethttpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
Which I assume was the result of running the commands
sudo chkconfig httpd on sudo chkconfig --levels 235 httpd on sudo chkconfig --levels 345 httpd on
in different attempts to configure this thing correctly in my provisioning script. I am not using Puppet or Chef, nor do I really want to. I had this working on a different host machine, but on the second host it seems to have stopped working for some reason.
Manually starting the service with
sudo service httpd start
works fine, but as soon as I do avagrant halt && vagrant up
orvagrant reload
the service will not start when the VM comes back up.Frustratingly, the mysqld service, which I have configured in exactly the same way, comes up on startup perfectly fine.
My /var/log/httpd/error_log says this:
[Thu Apr 17 09:31:09 2014] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec) [Thu Apr 17 09:31:09 2014] [notice] Digest: generating secret for digest authentication ... [Thu Apr 17 09:31:09 2014] [notice] Digest: done [Thu Apr 17 09:31:09 2014] [notice] Apache/2.2.15 (Unix) DAV/2 PHP/5.5.11 configured -- resuming normal operations [Thu Apr 17 09:34:45 2014] [notice] caught SIGTERM, shutting down
-
user9517 about 10 yearsIf you do a simple reboot (ignoring vagrant) what happens ?
-
Michael Hampton about 10 yearsThe error log shows that it came up, but something told it to stop.
-
Oldskool about 10 yearsDo you happen to have your
/vagrant
mount set as DocumentRoot? That may not have been mounted when Apache tries to start, resulting in a missing/unreadable DocumentRoot, which is a reason for an immediate termination of Apache.
-