Vagrant: start Apache (httpd) on boot with CentOS
If you are using NFS to share your files between your host and your virtual machine with vagrant and the apache (httpd) does not start at boot on CentOS, it is because the NFS service is not ready before to start the httpd daemon and the directories are targetting on the shared directory.
So I found a good way to handle it on http://razius.com/articles/launching-services-after-vagrant-mount/, however the bdi service is not useful for, also the mount.vboxfs does not work if you are trying to mount it manually, anyway the easier way is creating a new udev entry.
Create the file /etc/udev/rules.d/50-vagrant-mount.rules and the next content:
SUBSYSTEM="module",ACTION=="add",RUN+="/etc/init.d/httpd start"
SUBSYSTEM="module",ACTION=="remove",RUN+="/etc/init.d/httpd stop"
When you halt and up your machine, then it will start without problem the httpd daemon.
enjoy!
















