Mise à jour de la méthode de configuration des vhosts

This commit is contained in:
Michael RICOIS 2014-12-16 15:30:39 +01:00
parent 4b2399cb72
commit b23ab10d16
7 changed files with 84 additions and 49 deletions

View File

@ -21,11 +21,18 @@ then
sudo touch /etc/mysql/vagrant
fi
# Installation Wkhtmltopdf
if [ ! -f /usr/local/bin/wkhtmltopdf ]
then
sudo dpkg -i /vagrant/data/wkhtmltox-0.12.1_linux-precise-amd64.deb
sudo apt-get -f install -y
fi
# Installation
if [ ! -f /usr/bin/php5 ]
then
sudo apt-get update
sudo apt-get install -y apache2 mysql-client-5.5 php5 php-apc php5-curl php5-xmlrpc php5-xsl php5-mysqlnd
sudo apt-get install -y apache2 mysql-client-5.5 php5 php-apc php5-curl php5-xmlrpc php5-xsl php5-mysqlnd php5-xdebug
sudo a2enmod autoindex deflate expires headers rewrite
fi
@ -41,21 +48,6 @@ then
fi
fi
# Installation Wkhtmltopdf
if [ ! -f /usr/local/bin/wkhtmltopdf ]
then
sudo dpkg -i /vagrant/data/wkhtmltox-0.12.1_linux-precise-amd64.deb
sudo apt-get -f install -y
fi
# Configuration Apache
if [ ! -f /etc/apache2/conf-available/httpd.conf ]
then
sudo cp /vagrant/data/httpd.conf /etc/apache2/conf-available/
sudo mkdir /home/vhosts/apachelog
sudo mkdir /home/vhosts/test
fi
# Configuration PHP / Apache
sudo sed -i -e 's/short_open_tag = Off/short_open_tag = On/g' /etc/php5/apache2/php.ini
sudo sed -i -e 's/;date.timezone =/date.timezone = Europe\/Paris/g' /etc/php5/apache2/php.ini
@ -72,20 +64,48 @@ sudo sed -i -e 's/;browscap = extra\/browscap.ini/browscap = \/etc\/php5\/apache
sudo sed -i -e 's/short_open_tag = Off/short_open_tag = On/g' /etc/php5/cli/php.ini
sudo sed -i -e 's/;date.timezone =/date.timezone = Europe\/Paris/g' /etc/php5/cli/php.ini
#Disable all website
# Configuration Apache
if [ ! -f /etc/apache2/conf-available/httpd.conf ]
then
sudo cp /vagrant/data/httpd.conf /etc/apache2/conf-available/
sudo mkdir /home/vhosts/apachelog
sudo mkdir /home/vhosts/test
fi
if [ ! -f /vagrant/vhosts/phpmyadmin ]
then
cp /vagrant/data/phpmyadmin /vagrant/vhosts/phpmyadmin
if
if [ ! -f /vagrant/vhosts/test ]
then
cp /vagrant/data/test /vagrant/vhosts/test
if
if [ ! -f /home/vhosts/phpmyadmin.conf ]
then
cp /vagrant/data/phpmyadmin.conf /home/vhosts/phpmyadmin.conf
fi
if [ ! -f /home/vhosts/test.conf ]
then
cp /vagrant/data/test.conf /home/vhosts/test.conf
fi
# Disable all website
cd /etc/apache2/sites-available/
for f in *; do sudo a2dissite $f; done;
sudo a2ensite default
DVHOSTS=''
for f in *; do DVHOSTS+=" $f"; done;
sudo a2dissite $f
# Copy Vhosts files
VHOSTS='000-default.conf'
cd /vagrant/vhosts/
for f in *; do
if [ -f $f ]
then
sudo cp -f $f /etc/apache2/sites-available/;
sudo a2ensite $f;
fi
if [ -f $f ]
then
sudo cp -f $f /etc/apache2/sites-available/;
VHOSTS+=" $f"
fi
done;
sudo a2ensite $VHOSTS
# Restart apache
sudo service apache2 restart
sudo service apache2 restart

View File

@ -21,6 +21,13 @@ then
sudo touch /etc/mysql/vagrant
fi
# Installation Wkhtmltopdf
if [ ! -f /usr/local/bin/wkhtmltopdf ]
then
sudo dpkg -i /vagrant/data/wkhtmltox-0.12.1_linux-trusty-amd64.deb
sudo apt-get -f install -y
fi
# Installation
if [ ! -f /usr/bin/php5 ]
then
@ -41,22 +48,6 @@ then
fi
fi
# Installation Wkhtmltopdf
if [ ! -f /usr/local/bin/wkhtmltopdf ]
then
sudo dpkg -i /vagrant/data/wkhtmltox-0.12.1_linux-trusty-amd64.deb
sudo apt-get -f install -y
fi
# Configuration Apache
if [ ! -f /etc/apache2/conf-available/httpd.conf ]
then
sudo cp /vagrant/data/httpd.conf /etc/apache2/conf-available/
sudo a2enconf httpd
sudo mkdir /home/vhosts/apachelog
sudo mkdir /home/vhosts/test
fi
# Configuration PHP / Apache
sudo sed -i -e 's/short_open_tag = Off/short_open_tag = On/g' /etc/php5/apache2/php.ini
sudo sed -i -e 's/;date.timezone =/date.timezone = Europe\/Paris/g' /etc/php5/apache2/php.ini
@ -74,20 +65,41 @@ sudo sed -i -e 's/;browscap = extra\/browscap.ini/browscap = \/etc\/php5\/apache
sudo sed -i -e 's/short_open_tag = Off/short_open_tag = On/g' /etc/php5/cli/php.ini
sudo sed -i -e 's/;date.timezone =/date.timezone = Europe\/Paris/g' /etc/php5/cli/php.ini
# Configuration Apache
if [ ! -f /etc/apache2/conf-available/httpd.conf ]
then
sudo cp /vagrant/data/httpd.conf /etc/apache2/conf-available/
sudo a2enconf httpd
sudo mkdir /home/vhosts/apachelog
sudo mkdir /home/vhosts/test
fi
if [ ! -f /home/vhosts/phpmyadmin.conf ]
then
cp /vagrant/data/phpmyadmin.conf /home/vhosts/phpmyadmin.conf
fi
if [ ! -f /home/vhosts/test.conf ]
then
cp /vagrant/data/test.conf /home/vhosts/test.conf
fi
# Disable all website
cd /etc/apache2/sites-available/
for f in *.conf; do sudo a2dissite $f; done;
sudo a2ensite 000-default.conf
DVHOSTS=''
for f in *.conf; do DVHOSTS+=" $f"; done;
sudo a2dissite $f
# Copy Vhosts files
VHOSTS='000-default.conf'
cd /vagrant/vhosts/
for f in *.conf; do
if [ -f $f ]
then
sudo cp -f $f /etc/apache2/sites-available/;
sudo a2ensite $f;
fi
if [ -f $f ]
then
sudo cp -f $f /etc/apache2/sites-available/;
VHOSTS+=" $f"
fi
done;
sudo a2ensite $VHOSTS
# Restart apache
sudo service apache2 restart
sudo service apache2 restart

View File

@ -0,0 +1,3 @@
Place you vhost *.conf files here
and execute vagrant provision to configure automatically apache.