Skip to content

Instantly share code, notes, and snippets.

@dhavalv
Last active March 26, 2019 19:22
Show Gist options
  • Save dhavalv/c620e57e825bf92334b71472588dc330 to your computer and use it in GitHub Desktop.
Save dhavalv/c620e57e825bf92334b71472588dc330 to your computer and use it in GitHub Desktop.
How to create virtual hosts in xampp Ubuntu 12.04

How to create virtual hosts in xampp Ubuntu 12.04

  • Uncomment below line from /opt/lampp/etc/httd.conf
#open with sublime
sudo subl /opt/lampp/etc/httpd.conf

# Virtual hosts
Include etc/extra/httpd-vhosts.conf
  • add below code to httpd-vhosts.conf
# opem xampp vhost file with sublime 
sudo subl /opt/lampp/etc/extra/httpd-vhosts.conf

#append code into httpd-vhosts.conf
# VirtualHost for laravel.dev
<VirtualHost *:80>
    ServerName laravel.dev
    ServerAlias www.laravel.dev
    DocumentRoot "/opt/lampp/htdocs/laravel/public"
    #below line is not required but it's define for pointing index.php
    DirectoryIndex index.php
    <Directory "/opt/lampp/htdocs/laravel/public">
        AllowOverride All
        Require all Granted
    </Directory>
</VirtualHost>
  • Register host entry into /etc/hosts
# open hosts file with sublime
sudo subl /etc/hosts

#add below to hosts file
127.0.0.1   www.laravel.dev
  • For Laravel, give permission 777 for writing cache or storage
sudo chmod -R 777 storage/
sudo chmod -R 777 bootstrap/cache/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment