Javascript,Nodejs,MongodDB,WordPress,CSS,PHP

LightBlog

Sunday, October 21, 2018

How to create virtual host in php apache server

How to create virtual host in php

1) go to xammp then click explorer
2) then go to apache folder
3) go to config floder then go to extra folder open httpd-vhosts.config file
4) open it in any editor copy last these line which is commented

##<VirtualHost *:80>
    ##ServerAdmin webmaster@dummy-host2.example.com
    ##DocumentRoot "E:/xamp/htdocs/dummy-host2.example.com"
    ##ServerName dummy-host2.example.com
    ##ErrorLog "logs/dummy-host2.example.com-error.log"
    ##CustomLog "logs/dummy-host2.example.com-access.log" common
##</VirtualHost>

Change it which you want:

<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host2.example.com
    DocumentRoot "E:/xamp/htdocs/dummy-host2.example.com"
    ServerName example.com
    ErrorLog "logs/dummy-host2.example.com-error.log"
    CustomLog "logs/dummy-host2.example.com-access.log" common
</VirtualHost>

Note : change DocumentRoot "E:\xamp\htdocs\build" (folder path of your project)
       ServerName exmpale.com

5) then go to c drive where your windows installed
and go to windows>System32>drivers>etc
open hosts file and save your ServerName  which you save in side apache folder

Example: 127.0.0.1   exampale.com

No comments:

Post a Comment