[tbnl-devel] Multiple virtual host

Phillip Jordan phillip.m.jordan at gmail.com
Wed Sep 28 10:49:55 UTC 2005


Nicolas Lamirault wrote:
> i use tbnl to manage some web site.
> i would like to know how can i do to have several web site ?
> i have this already :
>
> LispServer 127.0.0.1 3000 "tbnl"
>
> <Location /tbnl>
>   SetHandler lisp-handler
> </Location>

So far, so good.

> i would like to start a second web site
> someone know how can i do this ?
>
>
> <Location /foo>
>         SetHandler lisp-handler
> </Location>

OK, there are various options on either the Apache and the Lisp end, to
my knowledge. Note that I've not used all of them, so I may be wrong.

Lisp:

1.
If you want to run both websites from the same Lisp environment, you can
change the mod_lisp server ID. In your line

> LispServer 127.0.0.1 3000 "tbnl"

"tbnl" is the server ID. So you could add another LispServer directive
to your second <Location>, which has a different server ID. The server
id is communicated to TBNL via the "server-id" request header, which you
can check via the tbnl:header-in accessor. You could check this header
in your dispatchers and act accordingly.

2.
Multiple Lisp environments. For this to work, you'll need each Lisp
environment listening on a different port. On the Apache end, this is
very similar to the above method. The '3000' in the LispServer line is
the TCP port. Change this for your second <Location> and before calling
(tbnl:start-tbnl) for this location, (setq tbnl:*tbnl-port* <port>) to
the same port number.


Apache:
This depends what you mean by 'different websites'. From your message it
seems you just want a different directory ("/foo") on the same server.
In that case, the <Location> directive is the way to go.

If you want the two sites to be available at different hostnames, which
both point to the same physical ID, you need to use Apache's Virtual
Host capability.

You'll need to declare somewhere in the apache config that you're using
named virtual hosts, for example:

NameVirtualHost *:80

<VirtualHost *:80>
    ServerName tbnl.yourserver.org
    SetHandler lisp-handler
    LispServer 127.0.0.1 3000 "tbnl"
</VirtualHost>

<VirtualHost *:80>
    ServerName foo.yourserver.org
    SetHandler lisp-handler
    LispServer 127.0.0.1 3000 "foo"
</VirtualHost>

This is just the simplest setup, the details of configuring Apache
beyond this are off-topic on this list though, I think, but there's
plenty of documentation on the web out there, so you shouldn't have too
much trouble.

By the way, I'm setting up a website which is successfully using a
combination of virtual hosts/multiple Lisp environments, so that
definitely works. I'm new to TBNL and Lisp in general, I hope the
experts on the list will point out any errors in this post. :)

~phil
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: OpenPGP digital signature
URL: <https://mailman.common-lisp.net/pipermail/tbnl-devel/attachments/20050928/03297a55/attachment.sig>


More information about the Tbnl-devel mailing list