Accessing virtual host from computer on same local network

后端 未结 2 1456
野趣味
野趣味 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
    
    <VirtualHost project:81>
    
        DocumentRoot "D:/work/website"
        ServerName project:81
        <Directory "D:/work/website">
        Options Indexes FollowSymLinks Includes ExecCGI    
        AllowOverride All
        Order Allow,Deny
        Allow from all
        </Directory>
    </VirtualHost>
    

    What I had to do was this.

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

    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.

    0 讨论(0)
  • 2021-01-30 19:36

    Have you try to include the port at your client host's file?

    192.168.1.7:81 project

    0 讨论(0)
提交回复
热议问题