|
For starters, you need to specify the full host name of your site in the ServerName setting in the virtual host. Here's an example of a working virtual host container: <VirtualHost 127.0.0.1> ServerName www.default.com AlwaysDirectoryIndex On DirectoryIndex index.html DocumentRoot /www/myserver/htdocs UseCanonicalName Off HostNameLookups off IndexOrderDefault Ascending Name IndexOptions -IgnoreCase <Directory /www/myserver/htdocs> order allow,deny allow from all </Directory> </VirtualHost> If you need to have a virtual host that supports multiple host names, you can add ServerAlias' to that virtual host container. If a host name match is not found, Apache will use the first virtual host in your configuration file. You may want to read up on defining virtual hosts at http://httpd.apache.org (look in the 2.0 documentation). Also, the book "Professional Apache 2.0" covers this (and many other things) in great detail. Matt -----Original Message----- From: web400-bounces@xxxxxxxxxxxx [mailto:web400-bounces@xxxxxxxxxxxx] On Behalf Of PaulMmn Sent: Friday, March 31, 2006 12:21 AM To: web400@xxxxxxxxxxxx Subject: [WEB400] # Apache Virtual Hosts I've been poking at an Apache Virtual Host issue for a couple of days now... and I'm not making any dents in it. I'm trying to establish Named Virtual Hosts using Apache. All virtual hosts are monitoring the same address/port. Everything is defaulting to the first virtual host. I can re-arrange the virtual hosts, and the first one in the list is the one that gets chosen, every time. I think I have everything set up properly, but I'm not having any luck. There was a similar issue in the archives from about 2 years ago, but there was never a resolution posted. ): Nothing I found in the archives appears to address my problem. Anyone have anything I can check to make it possible to use any of the 3 hosts as needed? Thanks for any hints. --Paul E Musselman PaulMmn@xxxxxxxxxxxxxxxxxxxx Server 1: # Apache Default server configuration # General setup directives HotBackup Off CgiConvMode %%MIXED/MIXED%% TimeOut 30000 KeepAlive Off DocumentRoot /www/apachedft/htdocs AddLanguage en .en Listen 10.1.10.1:80 # Deny most requests for any file <Directory /> order allow,deny deny from all Options -Indexes -ExecCGI -includes AllowOverride Limit Options </Directory> # Allow requests for files in document root <Directory /www/apachedft/htdocs> order allow,deny allow from all </Directory> <Directory /www/specs/htdocs> order allow,deny allow from all </Directory> NameVirtualHost 10.1.10.1:80 <VirtualHost 10.1.10.1:80> ServerName apachedft ServerPath /www/apachedft DocumentRoot /www/apachedft/htdocs </VirtualHost> <VirtualHost 10.1.10.1:80> ServerName specs ServerPath /www/specs DocumentRoot /www/specs/htdocs </VirtualHost> ************End of Data******************** Server 2: 5722SS1 V5R2M0 020719 Edit File 03/29/06 18:05:41 Page 1 File Name: /www/was60/conf/httpd.conf Start record . . : 1 WebSpherePluginConfig /QIBM/UserData/WebSphere/AppServer/V6/Base/profiles/default/config/cells /GCC2/nodes/IHS_GCC2_WAS60_node/serve LoadModule was_ap20_module /QSYS.LIB/QWAS6.LIB/QSVTAP20.SRVPGM # Configuration originally created by Create HTTP Server wizard on Tue Dec 06 14:02:35 EST 2005 # Listen 80 # DocumentRoot /www/was60/htdocs # ServerName was60 # default for very old browsers... # Options -ExecCGI -FollowSymLinks -SymLinksIfOwnerMatch -Includes -IncludesNoExec -Indexes -MultiViews LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined LogFormat "%{Cookie}n \"%r\" %t" cookie LogFormat "%{User-agent}i" agent LogFormat "%{Referer}i -> %U" referer LogFormat "%h %l %u %t \"%r\" %>s %b" common CustomLog logs/access_log combined LogMaint logs/access_log 7 0 LogMaint logs/error_log 7 0 # SetEnvIf "User-Agent" "Mozilla/2" nokeepalive SetEnvIf "User-Agent" "JDK/1\.0" force-response-1.0 SetEnvIf "User-Agent" "Java/1\.0" force-response-1.0 SetEnvIf "User-Agent" "RealPlayer 4\.0" force-response-1.0 SetEnvIf "User-Agent" "MSIE 4\.0b2;" nokeepalive SetEnvIf "User-Agent" "MSIE 4\.0b2;" force-response-1.0 # <Directory /> Order Deny,Allow Deny From all </Directory> <Directory /www/was60/htdocs> Order Allow,Deny Allow From all </Directory> <Directory /www/specsgcc2/htdocs> Order Allow,Deny Allow From all </Directory> <Directory /www/pemtest01/htdocs> Order Allow,Deny Allow From all </Directory> # NameVirtualHost *:80 # First VirtualHost is the default!! # <VirtualHost _default_:80> is never used for name-based vHosts! # <VirtualHost _default_:*> this is default for any port; default for :80 must be before this line! <VirtualHost *:80> ServerName pemtest01 DocumentRoot /www/pemtest01/htdocs ServerPath /www/pemtest01 </VirtualHost> <VirtualHost *:80> ServerName was60 DocumentRoot /www/was60/htdocs ServerPath /www/was60 </VirtualHost> <VirtualHost *:80> ServerName specsgcc2 DocumentRoot /www/specsgcc2/htdocs ServerPath /www/specsgcc2 </VirtualHost> ************End of Data********************
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.