Re: Apache Virtual Hosts Local Machine Help

From: Date: Wed, 24 Jul 2002 00:54:46 +0000
Subject: Re: Apache Virtual Hosts Local Machine Help
References: 1 2  Groups: php.windows 
Request: Send a blank email to php-windows+get-14925@lists.php.net to get a copy of this message
Indulging some patience to list subscribers regarding a not 100% in topic message (but nevertheless very usefull to php under windows)... Here is as promissed a overview of my configs with virtual hosting with apache under windows... Install apache then... change the hosts file located in \winnt\system32\drivers\etc
127.0.0.1    localhost
127.0.0.1    otherdomainalias
then at the end of apache hosts.conf there is the following block # # Use name-based virtual hosting. # #NameVirtualHost * # # VirtualHost example: # Almost any Apache directive may go into a VirtualHost container. # The first VirtualHost section is used for requests without a known # server name. # #<VirtualHost *>
#    ServerAdmin webmaster@dummy-host.example.com
#    DocumentRoot /www/docs/dummy-host.example.com
#    ServerName dummy-host.example.com
#    ErrorLog logs/dummy-host.example.com-error_log
#    CustomLog logs/dummy-host.example.com-access_log common
#</VirtualHost> uncoment the following: NameVirtualHost * <VirtualHost *> ServerAdmin webmaster@localhost DocumentRoot C:/Apache/htdocs ServerName localhost ErrorLog logs/localhost.example.com-error_log CustomLog logs/localhost.example.com-access_log common </VirtualHost> <VirtualHost *> ServerAdmin webmaster@otherdomainalias DocumentRoot e:/sites ServerName otherdomainalias ErrorLog logs/otherdomainalias.example.com-error_log CustomLog logs/otherdomainalias.example.com-access_log common </VirtualHost> The entries that matter are the DocumentRoot which must point to a winnt valid directory (root directory on one disk won't do) and ServerName which must mimick each of the entries inserted in the hosts Then restart apache and it should have two domains locally configured (the operative word is locally, because as there isn't a dns server, they will only work locally, unless on want's to indulge in a very complex dns hand administrations by shuffling hosts and lmhost files arround!)... You just need to repeat the virtual host block for each aliased domain to 127.0.0.1... Hope that helps... To me is invaluable to test and develop in PHP/MySQL with diferent domains at the same time and also to allow local documentation when that is distributed as html files... Cheers, Luis Ferro

« previous php.windows (#14925) next »