-
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
- Edit /opt/lampp/etc/extra/httpd-vhosts.conf file
- 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/