title: Apache doesn't start after Vagrant reload
body: <p>I'm trying to set up a simple dev environment with Vagrant. The base box (that I created) has CentOS 6.5 64bit with Apache and MySQL.</p>
  
  <p>The issue is, the httpd service doesn't start on boot after I reload the VM (<code>vagrant reload</code> or <code>vagrant halt</code> then <code>up</code>).</p>
  
  <p>The problem only occurs when I run a provision script that alters the <code>DocumentRoot</code> and only after the first time I halt the machine.</p>
  
  <h3>More info:</h3>
  
  <p>httpd is on <code>chkconfig</code> on levels 2, 3, 4 and 5</p>
  
  <p>There are no errors written to the error_log (on <code>/etc/httpd/logs</code>).</p>
  
  <p>If I ssh into the machine and start the service manually, it starts with no problem.</p>
  
  <p>I had the same issue with other CentOS boxes (like the <code>chef/centos-6.5</code> available on vagrantcloud.com), that's why I created one myself.</p>
  
  <p>Other services, like mysql, start fine, so it's a problem specific to apache.</p>
  
  <h3>Resuming:</h3>
  
  <ul>
  <li>httpd always start on first boot, even with the provision script (like after vagrant destroy)</li>
  <li>httpd always start when I don't run a provision script (but I need it to set the DocumentRoot)</li>
  <li>httpd doesn't start after first halt, with a provision script that messes with DocumentRoot (not sure if that's the problem).</li>
  </ul>
  
  <hr>
  
  <p>This is my Vagrantfile:</p>
  
  <pre><code># -*- mode: ruby -*-
  # vi: set ft=ruby :
  
  VAGRANTFILE_API_VERSION = "2"
  
  Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  
    config.vm.box = "centos64_lamp"
    config.vm.box_url = "&lt;url&gt;/centos64_lamp.box"
    config.vm.hostname = "machine.dev"
    config.vm.network "forwarded_port", guest: 80, host: 8080
    config.vm.synced_folder ".", "/vagrant", owner: "root", group: "root"
    config.vm.provision :shell, :path =&gt; "vagrant_files/bootstrap.sh"
  
  end
  </code></pre>
  
  <p>I tried to create the vagrant folder with owner/group <code>root</code> and <code>apache</code>. Same problem with both (as with owner <code>vagrant</code>).</p>
  
  <p>These are the provision scripts (bootstrap.sh) that I tried. The only thing that I want them to do is to change the DocumentRoot to the vagrant folder. Neither worked.</p>
  
  <p>Try 1</p>
  
  <pre><code>#!/usr/bin/env bash
  
  sudo rm -rf /var/www/html
  sudo ln -fs /vagrant/app/webroot /var/www/html
  </code></pre>
  
  <p>Try 2</p>
  
  <pre><code>#!/usr/bin/env bash
  
  sudo cp /vagrant/vagrant_files/httpd.conf /etc/httpd/conf
  sudo service httpd restart
  </code></pre>
  
  <p>The httpd.conf on the second try is equal to the default one, except for the DocumentRoot path. This second alternative allows me to do <code>vagrant up --provision</code> to force the restart of the service, but that should be an unnecessary step.</p>
  
  <p>What else can I try to solve this? Thank you.</p>