Jump to content

Vagrant box setup not working and I'm missing why


Recommended Posts

Hi all. It's late and I'm hoping I'm just missing something simple because I can't get this working and it's driving me a bit crazy. I'm trying to set up a simple vagrant Ubuntu 18.04 box. The up and provisioning is actually working so far as I can tell - I can connect to phpmyadmin through Firefox and I can ssh into the box after up, but trying to navigate to http://node.server.test in Firefox fails with a 404. And I'm confused about that. So, my Vagrantfile contains this:

config.vm.synced_folder "../pkg", "/var/www",
    create: true,
    owner: "vagrant",
    group: "www-data",
    mount_options: ["dmode=777,fmode=777"]

  # Provider-specific configuration so you can fine-tune various
  # backing providers for Vagrant. These expose provider-specific options.
  config.vm.provider "virtualbox" do |vb|
  #   # Name the VirtualBox
	  vb.name = "Node Server Testing"
  #   # Customize the amount of memory on the VM:
    vb.memory = "1024"

and my provision script contains this:

echo "install apache"
sudo apt-get -y install apache2
VHOST=$(cat <<EOF
<VirtualHost *:80>
	ServerName "node.server.test"
	DocumentRoot "/var/www/public_html"
	<Directory "/var/www/public_html">
		AllowOverride All
		Order allow,deny
		Allow from all
	ErrorLog ${APACHE_LOG_DIR}/error.log
	CustomLog ${APACHE_LOG_DIR}/access.log combined
echo "${VHOST}" > /etc/apache2/sites-available/node.server.test.conf
sudo a2ensite node.server.test
sudo a2enmod rewrite
sudo phpenmod mcrypt
sudo service apache2 restart
sudo rm -r /var/www/html

Directory structure on the containing Windows box is as follows:


This works in my other Vagrant boxes, but this one is simply not working. And again, what's weird is that I can connect to http://node.server.test/phpmyadmin/ without a problem. So I figure it's got to be an issue in the Vagrantfile sync directive or the setup Apache virtual host setup, but I can't find it.

Many thanks in advance for any advice or pointing out the glaringly obvious mistake that I've made somewhere.

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.