Vagrant将默认webroot从/ var / www更改为/ var / www / app / web-suite / shell脚本

时间:2016-03-02 08:58:18

标签: shell vagrant vagrant-provision

我提供了来自/var/www/app/web-suite/的索引,而不是/var/www/,但是当我尝试访问该框时,我无法确定如何将其设为默认位置(即:192.168.33.10),我当前的配置脚本如下:

echo "running script in the VM"
apt-get updat
apt-get -y dist-upgrade
echo "------------------------------------------------------------"
echo "Installing LAMP stack"
echo "------------------------------------------------------------"
apt-get install apache2
echo mysql-server-5.1 mysql-server/root_password password root | debconf-set-selections
echo mysql-server-5.1 mysql-server/root_password_again password root | debconf-set-selections
apt-get install -y mysql-server
add-apt-repository ppa:ondrej/php5-5.6
apt-get update
apt-get install -y php5
apt-get install -y php5-mysql
service apache2 restart
echo "------------------------------------------------------------"
echo "Ruby Gems Installs"
echo "------------------------------------------------------------"
apt-get install -y ruby-full build-essential
gem install compass --version 0.12.6
gem install zurb-foundation
gem install rubygems-update
echo "------------------------------------------------------------"
echo "Installing Composer"
echo "------------------------------------------------------------"
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/var/www/html
cd ../../var/www/html/
# wget https://phar.phpunit.de/phpunit.phar
# chmod +x phpunit.phar
# mv phpunit.phar /usr/local/bin/phpunit
php composer.phar global require "phpunit/phpunit=5.0.*"
php composer.phar install
echo "------------------------------------------------------------"
echo "Start up Compass Compiling"
echo "------------------------------------------------------------"
cd app/web-root/css/v1/
sudo compass init
sudo compass compile
echo "------------------------------------------------------------"
echo "Provisioning Complete"
echo "------------------------------------------------------------"

1 个答案:

答案 0 :(得分:1)

正如您对问题的评论中所讨论的那样,我通常会使用单独的.conf执行此操作,然后由该条款复制并启用。

sudo cp /vagrant/<myconf>.conf /etc/apache2/sites-enabled/

作为自定义.conf的开始:

<VirtualHost *:80>
    DocumentRoot /var/www/app/web-suite/
</VirtualHost>