Skip to content

Instantly share code, notes, and snippets.

@ron4stoppable
Created October 4, 2016 06:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ron4stoppable/c749c4062fd35de10e64ceabec0ece2b to your computer and use it in GitHub Desktop.
Save ron4stoppable/c749c4062fd35de10e64ceabec0ece2b to your computer and use it in GitHub Desktop.
Virtual host configuration for Apache, with example from Windows environment
# Virtual host configuration for apache
# Windows location : C:\xampp\apache\config\extra\httpd-vhosts.config
#
# incase you have installed in some other stack or installed in other location, find in appropriate directory
#
# after setting up the httpd-vhosts.config, add the site name to hosts file located at
# 'C:\Windows\System32\drivers\etc\hosts' , it is a text file with no extension, if it do not exist, create the file.
# and your site's name at the end of it -
# 127.0.0.1 laravel.dev
# 127.0.0.1 mysite.dev
#
# use <VirtualHost site.name:80> to redirect only to the particular URL, if you wish to block all connections
# then use <VirtualHost *:80>
# ---------------------------------
# Use this if its a standalone app build from scratch (i.e. no framework)
# VirtualHost for mysite.dev
<VirtualHost mysite.dev:80>
DocumentRoot "C:\xampp\htdocs\mysite"
ServerAdmin ron.cv
<Directory "C:\xampp\htdocs\mysite">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
# ---------------------------
# if using any framework, like laravel, set the document root to the public directory,
# or the directory where driving index.php file is located
#
# VirtualHost for LARAVEL.DEV
<VirtualHost laravel.dev:80>
DocumentRoot "C:\xampp\htdocs\laravel\public"
ServerAdmin laravel.dev
<Directory "C:\xampp\htdocs\laravel\">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment