PressTigers

How To Make Virtual Host In Windows

If you are a developer and you have worked on multiple sites on your local host then you are basically running multiple websites on a single server, via name-based or IP-based virtual hosts. This article attempts to answer the commonly-asked questions about setting up virtual hosts. According to Apache, the term Virtual Host refers to running more than one website (such as presstigers1.example.com and presstigers2.example.com) on a single machine.

Making a virtual host on your local server is quite easy, but without knowing the exact process it could end up in causing some problems in your local server. Then you might have to re-install it. We are providing a complete guide for this process in order to save you and your local server from chaos.

First of all, you need to update your hosts file. If you don’t know where it is located then go to your Windows folder. It is usually located in C drive. Assuming your Windows is installed in C drive, here is a complete path to the hosts file:

C:WindowsSystem32driversetchosts

hosts_location

You need to update hosts here but probably your system won’t allow to edit it, so if it is not allowing you to modify or make any changes in this file, simply copy this file to somewhere else. After that, make your desired changes and then replace it in ‘etc’ folder. Lets say you want a presstigers.dev as a new domain on your local host then simply paste the following line in your hosts file:

127.0.0.1    presstigers.dev

edit_in_hosts

Now we need to make changes in httpd-vhosts.conf file. It is located in your Apache. If you are using XAMPP and it is installed in C drive, the following should be your path to this file.

C:xamppapacheconfextrahttpd-vhosts.conf

Now, put the following lines in this file and save it:

httpd-conf-vhosts

You need to make sure that you have changed the DocumentRoot and Directory with your project’s path. After saving this file, restart your Apache and access presstigers.dev from your browser. You must be able to access your website now.

User Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

    Get in Touch