Created
December 14, 2015 12:10
-
-
Save durvalrafael/7b1d20f2b564306f183f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| echo "Server name :" | |
| read vhost | |
| echo "Main path (Ex.: /var/www/example) :" | |
| read path | |
| echo "Creating VHost configuration" | |
| echo "<VirtualHost *:80> | |
| ServerAdmin webmaster@localhost | |
| ServerName $vhost | |
| ServerAlias www.$vhost | |
| DocumentRoot /var/www/$path | |
| <Directory /var/www/$path> | |
| Options Indexes FollowSymLinks MultiViews | |
| AllowOverride All | |
| Order allow,deny | |
| Allow from all | |
| </Directory> | |
| </VirtualHost>" > /etc/apache2/sites-available/$vhost.conf | |
| echo "Enabling VHOST $vhost" | |
| a2ensite $vhost.conf | |
| echo "Updating hosts" | |
| echo "127.0.1.1 $vhost www.$vhost" >> /etc/hosts | |
| echo "Restarting apache"; | |
| service apache2 restart | |
| echo "VHOST created "; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment