NYCPHP Meetup

NYPHP.org

[nycphp-talk] Virtual Hosts

Chris Snyder csnyder at chxo.com
Mon Sep 8 15:44:38 EDT 2003


You could add the remote machine to your local /etc/hosts (*nix) or 
c:/windows/hosts (win -- at least win98 and me) so that you could access 
it with a host name (or names) that weren't resolved via DNS.

 From my /etc/hosts file:

192.168.123.60  mothra
192.168.123.60  sub.mothra

192.168.123.60 is a box on my local network, no DNS records for it but I 
can still go to http://mothra/ or http://sub.mothra/ and end up where I 
want to be. The httpd.conf on mothra has name virtual hosts that 
correspond to those hostnames.

    csnyder

Jeff wrote:

>I was looking at Dan Kushner's presentation on Setup/Dev under Win2000
>at 
>http://www.nyphp.org/content/presentations/ampintro3/ 
>
>I found this on slide 19 of the presentation. 
>
>      <VirtualHost *>
>         DocumentRoot "c:\sites\foo.localhost"
>         ServerName foo.localhost
>         php_value auto_prepend_file
>"c:\sites\foo.localhost\prepend.inc"
>      </VirtualHost>
>
>      <VirtualHost *>
>         DocumentRoot "c:\sites\bar.localhost"
>         ServerName bar.localhost
>      </VirtualHost> 
>
>The question is, how do I adapt this for the following scenario:
>
>My development is done on a separate server (Linux box) and is accessed
>solely with an IP address. Therefore, I'm not doing development on the
>same box as PHP and, correct me if I'm wrong, I can't use "localhost" as
>part of the address to get to the Linux box. How do I accomplish the
>virtual hosting thing in this scenario? (At present I'm using port
>numbers but that's kinda clumsy.)
>
>Jeff
>
>_______________________________________________
>talk mailing list
>talk at lists.nyphp.org
>http://lists.nyphp.org/mailman/listinfo/talk
>  
>




More information about the talk mailing list