The issue I'm having is that when I visit http://d7.subdomain.example.org from my host machine, it takes me to the default apache It Works page. I'm on a Mac host with a Ubuntu 12.04 Vagrant box with virtualbox provider.
I've checked sites-enabled/ and the site does appear there after running the sudo a2ensite d7.subdomain.example.org
command. If I go to http://d7.subdomain.example.org/drupal/site-docroot it takes me to the right place. It seems like it's ignoring my vhost all together.
My Vagrantfile:
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = "precise32"
config.vm.box_url = "http://files.vagrantup.com/precise32.box"
config.hostmanager.enabled = true
config.hostmanager.manage_host = true
config.vm.define "drupal" do |node|
node.vm.hostname = "d7.subdomain.example.org"
node.vm.network :private_network, ip: "172.22.22.26"
node.hostmanager.aliases = [ "www.d7.subdomain.example.org" ]
end
config.vm.provision :hostmanager
config.vm.synced_folder "./drupal", "/var/www/html/drupal/", type: "nfs"
config.vm.provider "virtualbox" do |vm|
vm.customize ["modifyvm", :id, "--memory", "2048"]
vm.customize ["modifyvm", :id, "--cpus", "1"]
vm.customize ["modifyvm", :id, "--cpuexecutioncap", "85"]
end
config.vm.provision "shell" do |script|
script.path = "provisioner.sh"
end
end
My provisioning script:
#! /bin/bash
sudo apt-get update -y
sudo apt-get install apache2 -y
sudo apt-get install debconf-utils -y
debconf-set-selections <<< "mysql-server mysql-server/root_password password rootpw"
debconf-set-selections <<< "mysql-server mysql-server/root_password_again password rootpw"
sudo apt-get install mysql-server -y
mysql -uroot -prootpw -e "CREATE DATABASE mydbford7;
USE mydbford7;
SOURCE /var/www/html/drupal/setup/dump.sql;
CREATE USER 'vagrant'@'localhost' IDENTIFIED BY 'vagrant';
GRANT ALL PRIVILEGES ON mydbford7.* TO 'vagrant'@'localhost' IDENTIFIED BY 'vagrant';
FLUSH PRIVILEGES;"
sed -i "s/bind-address.*/bind-address = 0.0.0.0/" /etc/mysql/my.cnf
sudo service mysql restart
sudo apt-get install python-software-properties build-essential -y
sudo add-apt-repository ppa:ondrej/php5 -y
sudo apt-get install php5-common php5-dev libapache2-mod-php5 php5-cli php5-fpm -y
sudo apt-get install curl php5-curl php5-gd php5-mcrypt php5-mysql -y
a2enmod rewrite
sed -i "s/AllowOverride None/AllowOverride All/g" /etc/apache2/apache2.conf
sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php5/apache2/php.ini
sed -i "s/display_errors = .*/display_errors = On/" /etc/php5/apache2/php.ini
cp /var/www/html/drupal/setup/myd7_vhost /etc/apache2/sites-available/d7.subdomain.example.org.conf
sudo a2ensite d7.subdomain.example.org
sudo service apache2 restart
sudo service apache2 reload
Virtual host file:
<VirtualHost *:80>
ServerName d7.subdomain.example.org
ServerAdmin me@example.com
DocumentRoot "/var/www/html/drupal/site-docroot"
<Directory "/var/www/html/drupal/site-docroot/">
Options All
AllowOverride All
Order allow,deny
Allow from all
</Directory>
ErrorLog "/var/log/apache2/error_log"
TransferLog "/var/log/apache2/access_log"
</VirtualHost>