Create virtual host in xampp on ubuntu

Step 1 - Adding VirtualHost feature to the Web Server

The first step is that you need to initiate the xampp virtual host will be enabled. To do this, simply uncomment the following line on /opt/lampp/etc/httpd.conf file.

# sudo gedit /opt/lampp/etc/httpd.conf
Uncomment the following line by removing '#'

Remove the asah(#) Change this line, as i given below

#Include etc/extra/httpd-vhosts.conf -> Include etc/extra/httpd-vhosts.conf

Step 2 - Adding your website to virtualhost configuration file

Next, you need to edit /opt/lampp/etc/extra/httpd-vhosts.conf file to add your website.

# sudo gedit /opt/lampp/etc/extra/httpd-vhosts.conf

Add the following text to the bottom of the file.

<VirtualHost *:80>
DocumentRoot /opt/lampp/htdocs/example
ErrorLog logs/
CustomLog logs/ common

Step 3 - Registering your new website

Add your new website to /etc/hosts file

# sudo gedit /etc/hosts
Add the following lines    localhost

Step 4 - Restart XAMPP and test your new website

Lastly, restart your xampp server

# sudo opt/lampp/lampp restart

Go to to view your new website.


Popular posts from this blog

Azure Cloud service problem "The current service model is out of sync"

Creating an Image Watermark

Drupal 8 Media Library with SVG upload