How to Setup multiple sites on your local machine using local ip in XAMPP or Apache

Setup multiple sites on your local machine using local ip in XAMPP or Apache


Step 1: Make your apache to listen to multiple ports. Go to C:\xampp\apache\conf\httpd.conf and search for the key word Listen you can see something like this Listen 80. Now tell your apache to listen to multiple ports, replace that with below content

Listen 80
Listen 81
Listen 82
Listen 83

Step 2: Now go to “C:\xampp\apache\conf\extra\httpd-vhosts.conf”, this is the actual player. At the end of the file you can specify something like this below:

<VirtualHost *:80>
    ##ServerAdmin webmaster@dummy-host2.example.com
    DocumentRoot "C:/xampp/htdocs/Project.com"
    ServerName www.192.168.192.1
ServerAlias 192.168.192.1
    ErrorLog "logs/Project.com-error.log"
    CustomLog "logs/Project.com-access.log" common
</VirtualHost>

<VirtualHost *:81>
    ##ServerAdmin webmaster@dummy-host2.example.com
    DocumentRoot "C:/xampp/htdocs/Project1.com"
    ServerName www.192.168.192.1
ServerAlias 192.168.192.1
    ErrorLog "logs/Project1.com-error.log"
    CustomLog "logs/Project1.com-access.log" common
</VirtualHost>

<VirtualHost *:82>
    ##ServerAdmin webmaster@dummy-host2.example.com
    DocumentRoot "C:/xampp/htdocs/Project2.com"
    ServerName www.192.168.192.1
ServerAlias 192.168.192.1
    ErrorLog "logs/Project2.com-error.log"
    CustomLog "logs/Project2.com-access.log" common
</VirtualHost>

<VirtualHost *:83>
    ##ServerAdmin webmaster@dummy-host2.example.com
    DocumentRoot "C:/xampp/htdocs/Project3.com"
    ServerName www.192.168.192.1
ServerAlias 192.168.192.1
    ErrorLog "logs/Project3.com-error.log"
    CustomLog "logs/Project3.com-access.log" common
</VirtualHost>

Step 3: open 80,81,82 & 83 port in windows firewall to access in lan


Step 4: open browser in client machine use this link

http://192.168.192.1             for:  project
http://192.168.192.1:81        for:  project1
http://192.168.192.1:82        for:  project3
http://192.168.192.1:83        for:  project3

Enjoy.
SHARE

Ibrar Ansari

  • Image
  • Image
  • Image
  • Image
  • Image
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment