Setup a new Virtual Host domain in LAMPP Server

Date posted : 31/05/2019

In this post, we will be explaining how to setup a new virtual host domain in lampp server

What is VirtualHost:

Virtual host allows us to use an alias name for your website, configure the document root path of your actual website contents and log files name to write etc.,

Also we can add multiple domains in configuration section. So that we can host many websites in apache web service in order to serve your domains publicly.

Creating a new virtual host

Step 1

Open /opt/lampp/etc/httpd.conf file

Find and uncomment the #(hash) sign present to include the “httpd-vhosts.conf” file. It will look like below.

# Virtual hosts
Include etc/extra/httpd-vhosts.conf

Step 2

Create httpd-vhosts.conf file is its not there already. Open it and copy the below lines of code.

<VirtualHost *:80>
        ServerName pheonixsolutions.com
        ServerAlias www.pheonixsolutions.com
        ServerAdmin webmaster@localhost
        DocumentRoot "/opt/lampp/htdocs/pheonix"
        ErrorLog "logs/pheonixsolutions.com-error_log"
        CustomLog "logs/pheonixsolutions.com-access_log" common
</VirtualHost>

Please don’t forget to replace your own domain name and log file names.

Step 3

Restart LAMPP server

$ sudo /opt/lampp/lampp restart

Now verify your domain in browser by accessing http://pheonixsolutions.com/.

Thanks for using pheonix solutions.

You find this tutorial helpful? Share with your friends to keep it alive.

Leave a Reply