Accessing virtual host from computer on same local network

后端 未结 2 1481
野趣味
野趣味 2021-01-30 19:13

I am trying to make a setup so that I can access my website on a virtual host in computer A from computer B. Both A and B are on the same network. I am using xampp on Win 7.

2条回答
  •  野性不改
    2021-01-30 19:30

    Ok So Seto El Kahfi's reply to my very old question led me to do some more research and reading on Apache's website.

    So what I got is this, my NameVirtualHost directive was improper. So Instead of this,

    NameVirtualHost project:81
    
    
    
        DocumentRoot "D:/work/website"
        ServerName project:81
        
        Options Indexes FollowSymLinks Includes ExecCGI    
        AllowOverride All
        Order Allow,Deny
        Allow from all
        
    
    

    What I had to do was this.

    NameVirtualHost *:81
    
    
    
        DocumentRoot "D:/work/website"
        ServerName project
        
        Options Indexes FollowSymLinks Includes ExecCGI    
        AllowOverride All
        Order Allow,Deny
        Allow from all
        
    
    

    Notice the ' * ' , I could have used an IP Address there too.(In this case my server's(machine A) local IP) both work. Now all I had to do is enter "project:81" on the client machine, and I get what my eyes wished to see.. :)

    Few things I got from this.

    1) How to use NameVirtualHost(or what it's purpose basically is.). Read More here http://httpd.apache.org/docs/2.2/mod/core.html#namevirtualhost This one is also good http://www.thegeekstuff.com/2011/07/apache-virtual-host/

    2)You can use this via command line:

    httpd -D DUMP_VHOSTS
    

    to know how your virtual hosts are setup(will also give you some warnings regarding precedence if something's wrong with your setup)

    3)Other's gesture to help you makes you help yourself.. :) So keeping helping and rocking.

提交回复
热议问题