Vagrant でapacheを自動起動
Vagrant上のCentOSでhttpd.confをVagrant共有ディレクトリのシンボリックリンクにしているとOSブート時にhttpdが自動起動しない #vagrant #apache http://nori3tsu.hatenablog.com/entry/2014/03/22/123313
こちらに記載いただいてる通りに修正しました。 ちなみにCentos6.5でapacheは普通にyumでインストールした2.2.15です。
[vagrant@localhost ~]$ sudo vi /usr/local/bin/vagrant-mount-checker
/usr/local/bin/vagrant-mount-checker として新規作成
#!/bin/sh check_vagrant_mount() { local prog=$1; for ((i = 1; i <= 6; i++)) do [ -f /vagrant/Vagrantfile ] && return 0 sleep 5 done /usr/bin/logger -t vagrant-mount-checker "$prog couldn't start, because the vagrant shared directory didn't mount." return 1 }
[vagrant@localhost ~]$ sudo vi /etc/init.d/httpd
/etc/init.d/httpd に2行追加
#!/bin/bash # # httpd Startup script for the Apache HTTP Server # # chkconfig: - 85 15 # description: The Apache HTTP Server is an efficient and extensible \ # server implementing the current HTTP standards. # processname: httpd # config: /etc/httpd/conf/httpd.conf # config: /etc/sysconfig/httpd # pidfile: /var/run/httpd/httpd.pid # ### BEGIN INIT INFO # Provides: httpd # Required-Start: $local_fs $remote_fs $network $named # Required-Stop: $local_fs $remote_fs $network # Should-Start: distcache # Short-Description: start and stop Apache HTTP Server # Description: The Apache HTTP Server is an extensible server # implementing the current HTTP standards. ### END INIT INFO #↓この位置に2行追加 . /usr/local/bin/vagrant-mount-checker check_vagrant_mount `basename $0`|| exit 1
でゲストOSでrebootをしてもダメで
vagrantのほうで
> vagrant reload
でいけました。