Configuring LocalHost Xampp Server for Virtual Hosts

Installing Lamp on ubuntu server
30 December 2016

Configuring LocalHost Xampp Server for Virtual Hosts on windows

Installing LAMP Stack is an headache if your are new to developing and you wanna create a virtual server for development mode on your pc and at that time Xampp comes on handy. Xampp application is all in one package if you wanna install Php, Apache, Mysql and perl and installing it is very easy. In this blog we will show how to configure virtual hosts in local xampp server. By configuring virtual host we can assign different name to different directory instead of using localhost/path_to_directory we can access that directory by name you configured. So Lets start configuring virtual hosts.
Step1:- Edit Host File
To edit host file in windows we have to go to C:\Windows\System32\drivers\etc and edits hosts file and add the following to its end after that save it and close.. your_project_name

Step2:- Configure Virtual Host on Apache vHosts Config File
To edit config file we have to go to C:\xampp\apache\conf\extra and edit httpd-vhosts.conf file. Now we have to add some code at the end of this file which are :-

<VirtualHost *:80>
    ServerAdmin admin@your_project_name
    DocumentRoot "path_to_your_project_directory"
    ServerName your_project_name
    <Directory path_to_your_project_directory>
       AllowOverride All
       Require local
    ErrorLog "path_to_your_project_directory/error.log"
    CustomLog "path_to_your_project_directory/access.log"

After editing config file close it and save it. Now your are all set just restart xampp server. Now your can access your project through your project name instead of full path to your directory. Cheers!!

By Lakshay Jain

Tags: Cloud