>>>>> "EC" == Eric Cholet <[EMAIL PROTECTED]> writes:

EC> do you setup virtual hosts on the backend server? Different IPs, or
EC> different ports? Or just a flat url space, using mod_rewrite on the
EC> front-end to translate the urls?

I think I posted this example earlier.  This is just a snippet of the
relevant portions of the front/back end virtual configs.  It is not a
cookie-cutter example!

Basically, I use unique port number virtuals on the back-ends (so I
can redirect to localhost:XXXX bypassing some networking cruft) and
name-based virtuals on the front end, though any technique on the
front end will do.

I set "Port 80" on the back-end so that any redirects don't get sent
directly to the back-end.  Sometimes I also bind tightly to address
127.0.0.1 to prevent any outside connections when the two are on the
same box.

Stas, feel free to incorporate this example.

front end:

<VirtualHost 204.117.82.12>
  ServerName www.morebusiness.com
  ServerAlias morebusiness.com
  RewriteEngine On
  RewriteOptions 'inherit'
  # handle GIF and JPG images directly
  RewriteRule \.(gif|jpg|png|css|txt|cgi)$ - [last]
  RewriteRule ^/cgi-bin - [last]
  # pass off everything but images to the heavy-weight server via proxy
  RewriteRule ^/(.*)$ http://localhost:4077/$1 [proxy]

  Alias /_homepage /web/morebusiness/docs/_homepage-default
  Alias /_pageparts /web/morebusiness/docs/_pageparts-default

</VirtualHost>

<VirtualHost 204.117.82.12>
  ServerName govcon.morebusiness.com
  RewriteEngine On
  RewriteOptions 'inherit'
  # handle GIF and JPG images directly
  RewriteRule \.(gif|jpg|png|css|txt|cgi)$ - [last]
  RewriteRule ^/cgi-bin - [last]
  # pass off everything but images to the heavy-weight server via proxy
  RewriteRule ^/(.*)$ http://localhost:4078/$1 [proxy]

  Alias /_homepage /web/morebusiness/docs/_homepage-govcon
  Alias /_pageparts /web/morebusiness/docs/_pageparts-govcon

</VirtualHost>

back-end:

Port 80

Listen 4077
<VirtualHost localhost:4077>
  ServerName www.morebusiness.com
  Port 80
  DirectoryIndex index.brc index.ibrc index.shtml index.html

  ###########
  #
  # Get "real" remote IP address from Proxy and set it as our connection's
  # IP address so logging, etc., use that IP address.  Uses mod_perl handler.
  # For some reason, must be set per-virtual host.
  #
  ###########

  PerlPostReadRequestHandler My::ProxyRemoteAddr

  Alias /_homepage /web/morebusiness/docs/_homepage-default
  Alias /_pageparts /web/morebusiness/docs/_pageparts-default

</VirtualHost>

Listen 4078
<VirtualHost localhost:4078>
  ServerName govcon.morebusiness.com
  Port 80

  DirectoryIndex index.brc index.ibrc index.shtml index.html

  PerlPostReadRequestHandler My::ProxyRemoteAddr

  Alias /_homepage /web/morebusiness/docs/_homepage-govcon
  Alias /_pageparts /web/morebusiness/docs/_pageparts-govcon

</VirtualHost>

Reply via email to