You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by kloomis <kl...@it-resources.com> on 2006/03/01 19:57:19 UTC

[users@httpd] Virtual Hosts Problem

Hello:
I've read the apache Virtual hosts doc and looked at the examples and I 
still can't get my httpd.conf working 100% right.

Users access my server using an IP address, 123.456.789.012, and several 
different sub-domain names - abc.example.com , def.example.com, and 
ghi.example.com

I also use aliases and proxies to pass off requests from one host to 
another computer for processing.  Right now the config for the IP address 
that uses the proxies and aliases is defined outside the Virtual Hosts 
directives - which I believe is wrong, but it's working, and the other 
domain names go to the Virtual Hosts.  This is also a mixed ssl and 
unencrypted server. The addresses that go to 443 work OK, but only the 
default 80 works.  I have included what I believe are the 
pertinent  sections below.

Listen 80
Listen 443

ServerName example.com:80

DocumentRoot "/var/www/html/sgimis/pages"

<Directory />
     Options FollowSymLinks
     AllowOverride None
</Directory>

<DIRECTORY "/var/www/html/sgimis/pages">
    DirectoryIndex SGIMIS.html
     Order allow,deny
     Allow from all
</Directory>

ProxyPass /pdx/ http://192.168.1.101:8080/
ProxyPassReverse /pdx/ http://192.168.1.101:8080/

ProxyPass /pdx2/ http://192.168.1.101:8090/
ProxyPassReverse /pdx2/ http://192.168.1.101:8090/



Alias /sgipages "/var/www/html/sgimis/pages"

    <Directory "/var/www/sgimis/pages">
         Options Indexes MultiViews
         AllowOverride None
         Order allow,deny
         Allow from all
     </Directory>

Alias /sgigraphics "/var/www/html/sgimis/graphics"

    <Directory "/var/www/sgimis/graphics">
         Options Indexes MultiViews
         AllowOverride None
         Order allow,deny
         Allow from all
     </Directory>

NameVirtualHost *:443
NameVirtualHost *:80

<VirtualHost *:80>
    ServerAdmin webAdmin@example.com
    DocumentRoot /var/www/html
    ServerName example.com
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin webAdmin@example.com
    DocumentRoot /var/www/html/tty
    ServerName abc.example.com
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin webAdmin@example.com
    DocumentRoot /var/www/html/sgine
    ServerName def.example.com
</VirtualHost>

<VirtualHost *:443>
     ServerAdmin webAdmin@example.com
     DocumentRoot /var/www/html/newsgimis
     ServerName ghi.example.com
</VirtualHost>

The above doesn't work for abc.example.com or def.example.com, but it does 
work for ghi.example.com, 123.456.789.012. and example.com.

I tried commenting out the document root stuff and the proxy stuff outside 
the virtual hosts and putting it in a virtual host like below. This didn't 
work for requests coming from 123.456.789.012

<VirtualHost 123.456.789.012>
     ServerAdmin webAdmin@example.com
     DocumentRoot /var/www/html/sgimis/pages
     ServerName 123.456.789.012
     ProxyPass /pdx/ http://192.168.1.101:8080/
     ProxyPassReverse /pdx/ http://192.168.1.101:8080/

     ProxyPass /pdx2/ http://192.168.1.101:8090/
     ProxyPassReverse /pdx2/ http://192.168.1.101:8090/

Alias /sgipages "/var/www/html/sgimis/pages"

    <Directory "/var/www/sgimis/pages">
         Options Indexes MultiViews
         AllowOverride None
         Order allow,deny
         Allow from all
     </Directory>

Alias /sgigraphics "/var/www/html/sgimis/graphics"

    <Directory "/var/www/sgimis/graphics">
         Options Indexes MultiViews
         AllowOverride None
         Order allow,deny
         Allow from all
     </Directory>
</VirtualHost>

If anyone could provide some insight into this mess, I'd really appreciate it.

Thanks very much

Ken









---------------------------------------------------------------------
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


Re: [users@httpd] Virtual Hosts Problem .. more

Posted by kloomis <kl...@it-resources.com>.
At 01:57 PM 3/1/2006 -0500, I wrote:

Well, I've been able to configure my httpd.conf to serve two secure 
virtualhosts and the first page of a non-secure host, but not the following 
pages of the non-secure site.

The docs say I can't use name based virtual hosts with SSL, but it's 
working for the SSL sites, but it might be breaking the non-secured 
site?  Does anyone know how to set this up?

Here's my current config: (I've annotated it to try to explain what I'm 
trying to do)

### Section 3: Virtual Hosts

# I'm trying to serve secure and non-secure websites
NameVirtualHost *:80
NameVirtualHost *:443

# The current users of this site all use the ip address to get to it.
# This config works.
<VirtualHost 123.456.789.123:443>
     ServerAdmin webAdmin@example.com
     DocumentRoot /var/www/html/sgimis/pages
     ServerName 123.456.789.123:443
</VirtualHost>

# This site will be accessed by a FQDN
# It is working with this config
<VirtualHost *:443>
     ServerAdmin webAdmin@example.com
     DocumentRoot /var/www/html/newsgimis
     ServerName itr.example.com
</VirtualHost>

# This is the "main" domain site.
<VirtualHost *:80>
    ServerAdmin webAdmin@example.com
    DocumentRoot /var/www/html
    ServerName example.com
</VirtualHost>

# This one is a Drupal CMS PHP, MySQL site
# This is the one that's not working properly.
# I get to the index, but not any follow-on pages
<VirtualHost *:80>
    ServerAdmin webAdmin@example.com
    DocumentRoot /var/www/html/tty
    ServerName tty.example.com
</VirtualHost>

#This is another Drupal site
<VirtualHost *:80>
    ServerAdmin webAdmin@example.com
    DocumentRoot /var/www/html/sgine
    ServerName sgine.example.com
</VirtualHost>

Any help would be much appreciated.  I find httpd to be a mystery.

Thanks,

Ken