Apache fails to start on Vagrant

后端 未结 3 816
走了就别回头了
走了就别回头了 2021-02-19 16:32

In my Vagrant environment I have a guest Ubuntu Virtualbox with a LAMP with default settings.

I have my source code on the host machine in the same folder as my Vagrantf

3条回答
  •  终归单人心
    2021-02-19 16:44

    while upstart probably is a valid option, I had several issues using it with vagrant. I had to run several tasks that needed to be run as a privileged user, which I did not manage to get working with upstart.

    Starting from version 1.6.0 (May 6, 2014), vagrant provides the option to run a specific provisioner every time, so also after booting a halted VM with vagrant up.

    In your Vagrantfile, add:

    # a file, eg after-boot.sh
    config.vm.provision "shell", path: "after-boot.sh", run: "always"
    # or just inline
    config.vm.provision "shell", inline: "service apache2 restart", run: "always"
    

    note the run: "always", this will force vagrant to run the provisioner always, obviously it works just as well with any other provisioning system like chef or puppet.

提交回复
热议问题