Trouble with Vagrant - “404 - Not Found”

前端 未结 5 1135
逝去的感伤
逝去的感伤 2021-02-09 10:47

I am attempting to make a LAMP box using Vagrant. I have been told that it is quite simple to use. I am completely new to networks and virtual machines and have very little expe

5条回答
  •  无人及你
    2021-02-09 11:37

    I've experimented two working solutions:

    The first is to change the file /etc/apache2/sites-enabled/000-default.conf modifing DocumentRoot in /var/www instead of /var/www/html

    The second is to change the Vagrant file bootstrap.sh in the following way:

    #!/usr/bin/env bash
    
    apt-get update
    apt-get install -y apache2
    if ! [ -L /var/www/html ]; then
      rm -rf /var/www/html
      ln -fs /vagrant /var/www/html
    fi
    

    Beside that, for some reason I've had to change also the configuration of port forwarding in the Vagrantfile, adding the host_ip key, like this:

    Vagrant.configure(2) do |config|
      config.vm.box = "hashicorp/precise32"
      config.vm.provision :shell, path: "bootstrap.sh"
      config.vm.network :forwarded_port, host: 4567, guest: 80, host_ip: "127.0.0.1"
    end
    

提交回复
热议问题