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 get

httpd           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 a vagrant halt && vagrant up or vagrant 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
  • If you do a simple reboot (ignoring vagrant) what happens ?
    – user9517
    Apr 17, 2014 at 9:55
  • The error log shows that it came up, but something told it to stop. Apr 17, 2014 at 13:15
  • 3
    Do 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.
    – Oldskool
    Apr 17, 2014 at 14:08

2 Answers 2


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.



If httpd is on in chkconfig and the syntax is correct, it's probably your Apache document root points to synced folder which is not available at the time of starting the service.

The workaround is to provide shell script into your Vagrantfile which will check the service and start when required each time when vagrant command is invoked, e.g.

config.vm.provision :shell, run: "always", :inline => "service httpd status || service httpd start"


config.vm.provision :shell, run: "always", path: "scripts/check_vm_services.sh"

See also: Apache doesn't start after Vagrant reload at SO

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .