httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trli...@clayst.com
Subject [users@httpd] Multiple URLs / One Site
Date Mon, 26 Apr 2004 21:00:04 GMT
I have been struggling with how to configure a server the way I want. 
I've been reading about virtual hosting and have done some name-based 
virtual host setups before, but I'm no expert.

Today I realized that maybe the part I've been struggling with isn't 
virtual hosting at all.  It's not a configuration I've seen described 
before, and I read the virtual hosting docs, the FAQ, and whatever I 
could find with various Google searches and the MARC archive search 
here.  So far nothing quite fits.

Here is the setup:

The server is running Redhat Linux 8, 2.4.20 kernel, Apache 1.3.29 with 
SSL and PHP 4.3.4.  There are three IPs bound to a single NIC, call 
them x.x.x.1 through x.x.x.3.  It hosts:

    - A primary live site on the x.x.x.2 IP which includes http and
    https portions.  This site is not yet live, so we can muck with it
    without causing problems. 

    - A test version of the same site on the x.x.x.3 IP, also
    including both http and https access. 

    - Several miscellaneous low-volume sites on the x.x.x.1 IP. 

For the last portion (the .1 IP) we do use name-based virtual hosting, 
but I haven't included the config for that part as it is not where the 
questions lie.

The other IPs currently use IP-based virtual hosting as follows (I left 
out extraneous stuff like log setups and MissingDocument etc.):

########################################################################
# Live site -- HTTP
<VirtualHost x.x.x.2:80>
    # Basic setup
    ServerAdmin admin@livedomain.com
    DocumentRoot /path/to/livestuff
    DirectoryIndex index.php index.html index.shtml index.htm
    ServerName livedomain.com
</VirtualHost>

# Live site -- HTTPS
<VirtualHost x.x.x.2:443>

    # Basic setup
    ServerAdmin admin@livedomain.com
    DocumentRoot /path/to/livestuff
    DirectoryIndex index.php index.html index.shtml index.htm
    ServerName livedomain.com

    # SSL Setup -- for details see default SSL setup above
    <IfDefine SSL>
        SSLEngine on
        SSLCipherSuite ... 
        SSLCertificateFile ...
        SSLCertificateKeyFile ...
        <Files ~ "\.(cgi|shtml|phtml|php3?)$">
            SSLOptions +StdEnvVars
        </Files>
        <Directory "/path/to/live-cgi-bin">
            SSLOptions +StdEnvVars
        </Directory>
        SetEnvIf User-Agent ".*MSIE.*" \
                 nokeepalive ssl-unclean-shutdown \
                 downgrade-1.0 force-response-1.0
    </IfDefine>
</VirtualHost>

########################################################################
# Test site -- HTTP
<VirtualHost x.x.x.3:80>
    # Basic setup
    ServerAdmin admin@testdomain.com
    DocumentRoot /path/to/teststuff
    DirectoryIndex index.php index.html index.shtml index.htm
    ServerName testdomain.com
</VirtualHost>

# Test site -- HTTPS
<VirtualHost x.x.x.3:443>

    # Basic setup
    ServerAdmin admin@testdomain.com
    DocumentRoot /path/to/teststuff
    DirectoryIndex index.php index.html index.shtml index.htm
    ServerName testdomain.com

    <IfDefine SSL>
        SSLEngine on
        SSLCipherSuite ... 
        SSLCertificateFile ...
        SSLCertificateKeyFile ...
        <Files ~ "\.(cgi|shtml|phtml|php3?)$">
            SSLOptions +StdEnvVars
        </Files>
        <Directory "/path/to/live-cgi-bin">
            SSLOptions +StdEnvVars
        </Directory>
        SetEnvIf User-Agent ".*MSIE.*" \
                 nokeepalive ssl-unclean-shutdown \
                 downgrade-1.0 force-response-1.0
    </IfDefine>
</VirtualHost>
########################################################################

While the domains are not yet mapped, this setup is working so far.  I 
can go to http://x.x.x.2/ and I see what I should see, ditto for 
https://x.x.x.2/, and ditto for http and https access to x.x.x.3.

The next steps are:

    - Map livedomain.com to x.x.x.2 and testdomain.com to x.x.x.3 so I
    get access through the domain names.  That should be
    straightforward and I expect the above to work. 

    - Map securedomain.com to x.x.x.2 and test.securedomain.com to
    x.x.x.3. Again this seems OK, I just have to adjust the ServerName
    directives for the secure portion above.

The next step is the one I'm not clear on.  There are a bunch of other 
entitities who resell the services offered by livedomain.com and each 
will use this site.  All are accessing the *same* site, any differences 
in what they see based on the URL used for access are handled by the 
PHP code that runs the site (it looks at HTTP_HOST or the request URI). 
Each reseller will create a third-level domain through which to access 
the site.  So the DNS mapping look like this:

	services.reseller1.com		x.x.x.2
	services.reseller2.com		x.x.x.2

etc.  These are for the non-secure portion of the site only.  When we 
get to needing SSL everyone funnels through securedomain.com.  But up 
to that point, each one sees the site through their own URL -- at least 
that's what I want.

I am figuring I do not need virtual hosting for these mappings because 
they are not accessing separate sites, I don't need or want each to 
have a separate document root, etc.

If that's right then what, if anything, do I need to do to the above 
configuration to get the server to respond properly (I can't ask the 
other businesses involved to do test mappings for me, so I don't have a 
simple way to just try it and see)?  Does the server need to know each 
site's URL or can I get it to respond to anything that comes its way 
for that IP?  If so can I leave the ServerName set for the base site, 
or should it be changed?  If I leave it alone where does the server 
name show up for users who visit the site through one of the reseller 
URLs?

I'd appreciate any advice -- whether you think I just need some tweaks, 
or I've got the whole idea wrong (I'm hoping not!).

Thanks!

--
Tom




---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message