Access Apache VirtualHost from any computer on LAN?

半城伤御伤魂 提交于 2019-11-30 07:33:23

You either need <VirtualHost 192.168.1.101> (in addition to 127.0.0.1), or simply use <VirtualHost *> to put the VH on all addresses.

Just add below code in your virtual host config file
In the below code,
'Client_IP' is the IP of the machine from where you want to access the directory without using any ip on the address bar, just put severname in the address bar like 'servername/'.

<VirtualHost *:80>
   ServerName servername
   DocumentRoot d:\wamp\www\dir_name                        

    <Directory "d:\wamp\www\dir_name">                             
       Order Allow,Deny
       Allow from 127.0.0.1 Client_IP
    </Directory>
 </VirtualHost>

Then, set same servername that you have used for the virtual host on apache server like,

server_ip servername 

in the client machine c:/windows/system32/drivers/etc/hosts file.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!