Jump to content

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
	</Directory>
	ErrorLog ${APACHE_LOG_DIR}/error.log
	CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
EOF
)
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:

D:\node_server_testing
	pkg\
		os\
		public_html\
			index.html
	src\
		js\
		less\
	sysfiles\
		.vagrant\
		setup.sh
		Vagrantfile

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.