windows - Access virtual host from another machine over LAN -


  • i using windows 7 wamp 2.2 server.
  • i have setup 2 virtual hosts: www.project1.com , www.project2.com.
  • i have modified "hosts", httpd.conf, , httpd-vhosts.conf files, changes mentioned below.

using browser, when type www.project1.com or www.project2.com, web pages opened on laptop has server installed on.

changes in "hosts file": i've appended followings end of file:-

127.0.0.1       localhost 127.0.0.1       www.project2.com 127.0.0.1       www.project1.com 

changes in httpd.conf file:-

include conf/extra/httpd-vhosts.conf 

changes in httpd-vhosts file:-

namevirtualhost *:80  <directory "d:/websites/">     allowoverride     order deny,allow     allow     </directory> <virtualhost 127.0.0.1>     documentroot "d:/websites/wamp/www/"     servername localhost </virtualhost>   <virtualhost 127.0.0.1>     documentroot "d:/websites/project1/"     servername www.project1.com </virtualhost>   <virtualhost 127.0.0.1>     documentroot "d:/websites/project2/"     servername www.project2.com </virtualhost> 


now; since can open these web pages browser in pc_1 (the 1 server), how can access these web pages browser in pc_2? (i mean pc connected pc_1 via lan.)

in virtualhost directive, change 127.0.0.1 *:80 , gabriel mentioned, add entry hosts file in other machine, adding domain associated ip of server.

when put explicit ip directive, apache listen on ip - wildcard tell bind ips available it.

<virtualhost *:80>     documentroot "d:/websites/project1/"     servername www.project1.com </virtualhost> 

if server on 192.168.1.70 example, in other machines on lan, hosts entry like:

192.168.1.70     www.project1.com 

restart apache , should work fine.

as note, when using virtualhosts, apache use first definition default when can't make match between domain passed in http request header , sites setup in config, why default page appearing.

you told apache bind ips namevirtualhost *:80 directive, didn't setup site external ip. hope helps!


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -