You just have to update the following files:
First of all, uncomment the following line to enable name based virtual host on your server’s port 80:
Then you can start adding your virtual hosts. The following listing is just a sample, I usually do.I am assuming ,we create a project which should be accessible by entering http://demo-project in your browser’s address bar.
ServerAdmin [email protected]
Options Indexes FollowSymLinks Includes ExecCGI
Allow from all
Make sure the DocumentRoot exists and matches the Directory and remember the value you set for ServerName.
2. Edit your windows hosts file
Now your apache is ready,but you have to tell your system what to do if you enter http://demo-project in your browser.The most simple way to deal this is to update your hosts file you can find it from here.
(Path wil be different if windows installed else where)
The file is just a simple text file which contains IP-to-hostname mappings. Edit the file with a text editor and append a new line which maps the hostname you specified in apache’s ServerName-directive to 127.0.0.1. You can place it just under the existing one which defines localhost. In the end, your file could look like this:
# some comments
Restart your Apache Server in order to load the new configuration and enjoy 🙂