5

I have wamp setup with quite a few websites setup as virtual hosts like this in httpd.conf

<VirtualHost 127.0.0.1>
    ServerName project1.local
    DocumentRoot "c:/wamp/project1/"
</VirtualHost>

I have these input in the wamp machine's host file and I can access them just fine on that machine.

127.0.0.1 project1.local

However, when I try to put an entry on my OSX machine as (192.168.1.101 being the internal ip of the wamp machine) it won't pull the page up.

192.168.1.101 project1.local

Is there something else I need to do to make this work from other machines? Thanks!

Rapture
  • 1,876
  • 10
  • 23
  • 42
  • I think this answer can help you [Access virtual host from another machine](http://stackoverflow.com/questions/11245242/access-virtual-host-from-another-machine#answer-11342625) – نرم افزار حضور و غیاب Dec 17 '15 at 11:16
  • You just required to add another entry in your WAMP machine host file below the `127.0.0.1 project1.local`. This entry must be same as the entry on your OSX Machine: `192.168.1.101 project1.local`. Try changing to `` – ColinWa Mar 02 '17 at 10:56

2 Answers2

4

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.

user502515
  • 4,346
  • 24
  • 20
  • 1
    Awesome. Thanks. I added the IP address like this (for anyone else needing an answer): NameVirtualHost 192.168.1.101 NameVirtualHost 127.0.0.1 ServerName imagelark.local DocumentRoot "c:/dev/project1/" – Rapture Nov 27 '10 at 22:45
0

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.

Sachin
  • 1,273
  • 5
  • 16
  • 27