LoginSignup
59
54

More than 5 years have passed since last update.

Vagrantのup時、httpdが自動起動しないとき

Last updated at Posted at 2015-09-18

vagrantのup時にhttpdが自動起動しない。

困った、というわけでもないが毎回手動でstartしてやるのも面倒くさい。

どうやら共有ディレクトリがマウントされてない状態で起動しようとしてこけているらしい。。

参考:Vagrant上のCentOSでhttpd.confをVagrant共有ディレクトリのシンボリックリンクにしているとOSブート時にhttpdが自動起動しない #vagrant #apache

他にも解決方法はないかと色々探ってみたらどの検索結果も同じことを言っている。
「centos側の起動スクリプトをいじれ」

Linux側のをいじるのもなんやら面倒くさい。。

VagrantFile側でなんとかできないかなと思ったらできたのでメモ。

VagrantFile
config.vm.provision :shell, run: "always", :inline => <<-EOT
    sudo service httpd restart
EOT

この3行を末尾のendの手前あたりに追加してやればOK。
vagrantリファレンス
run "always"がミソ。

59
54
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
59
54