Access Apache virtual host over lan

我是研究僧i 提交于 2019-12-11 09:26:29

问题


i configured my xampp to use vhost

on apache/conf/extra/httpd-vhosts.conf i have

NameVirtualHost *:80  //uncommented

<VirtualHost *:80>
DocumentRoot "Z:/xampp/htdocs"
ServerName localhost
</VirtualHost>

<VirtualHost web1.project>
DocumentRoot "Z:/xampp/htdocs/web1" 
ServerName web1.project

<Directory "Z:/xampp/htdocs/web1">
Options Indexes FollowSymLinks ExecCGI Includes
    Order allow,deny
    Allow from all
</Directory>
</VirtualHost>

then on windows/system32/drivers/etc/hosts i have

127.0.0.1 localhost
127.0.0.1 web1.project

on my machine its works perfect, i can go direct on browser and access http://web1.project

but on another machines on same lan, dont works, ok i figured my IP

my network map i have all ips for each machine on my lan

the computer here xampp is running have 192.168.1.221

so like on my tablet i can go 192.168.1.221 and i have xampp running

if i go 192.168.1.221/web1 works

but http://web1.project don't works

any idea, what i need to do to have put this to work?

thanks.


回答1:


web1.project is not registered in your DNS.

A quick and dirty way to test it on other computer , you can add <IP ADDRESS> web1.project in its /etc/hosts. On android device, you can use https://play.google.com/store/apps/details?id=com.treb.hosts to modify that /etc/hosts file in android device(though I have never tested it though)



来源:https://stackoverflow.com/questions/22650186/access-apache-virtual-host-over-lan

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