[hunchentoot-devel] Multiple websites serving off the same hunchentoot server

Larry Clapp larry at theclapp.org
Sun Jun 7 14:08:55 UTC 2009


On Sun, Jun 07, 2009 at 12:37:21AM +0300, Mackram Raydan wrote:
> I recently started porting several websites I run to sbcl and wish
> to run them off hunchentoot but would like to run them of the same
> instance. Is there a way to have hunchentoot serve different
> directories to different websites? So what I am really asking is can
> hunchentoot do the following when it recieves a request from
> www.x.com it would serve pages from my directory /home/me/x and when
> it recieves a request from www.y.com it would serve pages from my
> directory /home/me/y
> 
> Appreciate any help that you could provide and thanks in advance.

You could configure Apache to do it for you.  Set up a "reverse proxy"
such that x.com goes to a Hunchentoot server listening on
localhost:1234, and y.com goes to a Hunchentoot server listening on
localhost:1235.  Both Hunchentoot servers could be running from the
same Lisp image, of course.

  <VirtualHost your.numeric.ip.address>
      ServerAdmin webmaster at x.com
      ServerName x.com

      ProxyRequests off
      ProxyPass / http://localhost:1234/
      ProxyPassReverse / http://localhost:1234/
  </VirtualHost>

  <VirtualHost your.numeric.ip.address>
      ServerAdmin webmaster at y.com
      ServerName y.com

      ProxyRequests off
      ProxyPass / http://localhost:1235/
      ProxyPassReverse / http://localhost:1235/
  </VirtualHost>

I use Apache to proxy only one Hunchentoot server right now, but I see
no reason the above wouldn't work.

See Edi's "Hunchentoot behind a proxy" documentation, and Apache's
"VirtualHost", "ProxyPass",  and "ProxyPassReverse" documentation.

-- Larry





More information about the Tbnl-devel mailing list