first post - i've read lots of threads on this and still confused: how to access virtual host names across a LAN using the server's ip or name?
I've upgraded to xampp 1.8.1 (was 1.7.7), control panel 3.1.0 on win 7 64 and have modified httpd-vhosts.conf and the hosts file to allow LAN access. works fine in that I can access the main xampp page across the LAN and my sites that are saved in c:\xampp\htdocs\...
I've wanted the document root for one site to be at the top of its folder (c:\xampp\htdocs\home\site1) to simplify my php paths (e.g $_SERVER['DOCUMENT_ROOT']) when uploading this to an online server. So I've also added a virtual host name for the folder as such:
- Code: Select all
NameVirtualHost *:80
# other stuff....
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/home/site1.local"
ServerName site1.local
ServerAlias www.site1.local
<Directory "C:/xampp/htdocs/home/site1.local">
Options Indexes FollowSymLinks Includes execCGI
#xampp 1.7.7 format:
Order allow,deny
Allow from all
#xampp 1.8.1 format add:
Require all granted
</Directory>
</VirtualHost>
And in hosts added:
- Code: Select all
127.0.0.1 site1.local
This all works well when accessing site1 on the same machine as xampp: e.g., http://site1.local -> loads fine.
BUT it fails when i try and access it across the LAN from other machines, e.g: 192.168.1.66/site1.local/ -> 404.
and while 192.168.1.66/home/site1.local/index.php loads, it breaks my 'includes' as the document root is now C:/xampp/htdocs (not C:/xampp/htdocs/home/site1.local).
I have checked httpd.conf where is set to 'Listen 80' and have tried 'Listen *:80' with no luck - i guess xampp is listening to all requests.
I've read various threads about modifying host files on each LAN machine but don't want to (there are macs, adroids,...) and am happy to type in the ip or network name. And I just don't understand why this doesn't work.
Can someone explain this for me, and preferably how to fix it.
thanks
Mike