Skip to content

Instantly share code, notes, and snippets.

@m-maranan
Created March 26, 2014 20:33
Show Gist options
  • Select an option

  • Save m-maranan/9792708 to your computer and use it in GitHub Desktop.

Select an option

Save m-maranan/9792708 to your computer and use it in GitHub Desktop.
Create a Virtual Host for a New Site
#!/bin/bash
# run with sudo create_vhost
# replace {path to public} eg /var/www/laravel/public
# Create the file with VirtualHost configuration in /etc/apache2/site-available/
echo "<VirtualHost *:80>
DocumentRoot {path to public}
ServerName lawfirmrater.dev
<Directory {path to public}>
Options +Indexes +FollowSymLinks +MultiViews +Includes
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>" > /etc/apache2/sites-available/lawfirmrater.dev.conf
# Add the host to the hosts file
echo 127.0.0.1 lawfirmrater.dev >> /etc/hosts
# Enable the site
a2ensite lawfirmrater.dev
# Reload Apache2
/etc/init.d/apache2 restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment