带有Vagrant的vHost Apache(ubuntu / trusty64)加载了同一个项目

时间:2016-01-19 15:03:57

标签: php apache vagrant virtualhost

我有这个vhost配置:

<VirtualHost *:80>
        ServerAdmin my@email.com
        ServerName local.startup.com

        DocumentRoot /var/www/start

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/acces.log combined

        <Directory /var/www/start>
                Options FollowSymLinks
                AllowOverride All
        </Directory>
</VirtualHost>

<VirtualHost *:80>
        ServerAdmin my@email.com
        ServerName local2.startup.com

        DocumentRoot /var/www/start2

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/acces.log combined

        <Directory /var/www/start2>
                Options FollowSymLinks
                AllowOverride All
        </Directory>
</VirtualHost>

vHost工作正常但仅适用于第一个。 当我去local2.startup.com时,它加载了local.startup.com的索引​​(第一个)

在我的/ etc / hosts文件中,我有以下一行:

192.168.33.10   local.startup.com local2.startup.com

这是我的流浪汉配置:

Vagrant.configure("2") do |config|
  config.vm.box = "ubuntu/trusty64"
  config.vm.provision :shell, path: "bootstrap.sh"
  config.vm.network :forwarded_port, guest: 80, host: 4567
  config.vm.network :private_network, ip: "192.168.33.10"
end

提供脚本:

#!/usr/bin/env bash

# Update Ubuntu
apt-get update

echo "----- Provision: Installing Apache..."
apt-get install -y apache2 apache2-utils
a2enmod rewrite
a2dissite 000-default.conf

echo "------ Provision: Setup var/www to point to /vagrant"
rm -rf /var/www
ln -fs /vagrant /var/www

echo "------- Provision: Install Host File"
cp /vagrant/hostfile /etc/apache2/sites-available/project.conf
a2ensite project.conf

apt-get -y autoremove

echo "------Provision: Restarting Apache..."
service apache2 restart

为什么它在另一个vHost上加载local.start.com索引的任何想法?

谢谢!

0 个答案:

没有答案