Skip to content

Instantly share code, notes, and snippets.

@divya-kanak
Created December 3, 2020 11:17
Show Gist options
  • Save divya-kanak/3ac4e38d6badaf0926a8933b5f9bd05b to your computer and use it in GitHub Desktop.
Save divya-kanak/3ac4e38d6badaf0926a8933b5f9bd05b to your computer and use it in GitHub Desktop.
  • Open terminal

  • Open httpd.conf file

sudo nano +488 /opt/lampp/etc/httpd.conf
  • Find below line
# Virtual hosts
# Include etc/extra/httpd-vhosts.conf
  • Uncomment the one that
Include etc/extra/httpd-vhosts.conf

If you need to new file then add below line

Include etc/extra/filename
EX : Include etc/extra/httpd-vhosts-personal-planner.conf
  • add vhost code by two way
  1. Edit /opt/lampp/etc/extra/httpd-vhosts.conf file
  2. create new file opt/lampp/etc/extra/httpd-vhosts-personal-planner.conf
  • create file and folder which need to triger
mkdir /opt/lampp/htdocs/example
gedit /opt/lampp/htdocs/example/index.html
  • Add the host to /opt/lampp/etc/extra/httpd-vhosts.conf OR opt/lampp/etc/extra/httpd-vhosts-personal-planner.conf
<VirtualHost *:80>
    ServerAdmin xyz@gmail.com
    DocumentRoot "/opt/lampp/htdocs/example"
    ServerName example.local
    ErrorLog "logs/example.local-error_log"
    CustomLog "logs/example.local-access_log" common
</VirtualHost>
  • Add the host to /etc/hosts
sudo gedit /etc/hosts
127.0.1.1	example.local
  • Restart lampp
sudo /opt/lampp/lampp restart
  • Visit
http://example.local/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment