Hi,

I've been looking in Cherokee for an option to have dynamic
VirtualHosts. What I've in mind is to host multiple/dynamic virtual
domains, for example:

* If visitor goes to joe.foobar.com, Cherokee will set the UserDir
to /home/joe/public_html and DocumentRoot to /usr/share/webapp.
* If visitor goes to peter.foobar.com, Cherokee will set the UserDir
to /home/peter/public_hml and DocumentRoot to /usr/share/webapp.

So Cherokee will be taking the *subdomain* part and using it as a
variable (%0, to give it a name), so domain names will be:

%0.foobar.com => /home/%0/public_html

Now, I've been looking in Cherokee doc and seems that Cherokee doesn't
support these kind of things as Apache does with mod_rewrite. In Apache
you can do this with mod_rewrite, don't know if there are plans to have
this option in Cherokee.

Here's an example in how to do this in Apache:

# get the server name from the Host: header
UseCanonicalName Off
# splittable logs
LogFormat "%{Host}i %h %l %u %t \"%r\" %s %b" vcommon
CustomLog logs/access_log vcommon
# now for the hard bit
RewriteEngine on
RewriteMap lowercase int:tolower
# allow CGIs to work
RewriteCond %{REQUEST_URI} !^/cgi-bin/
# check the hostname is right so that the RewriteRule works, support
only lowecase subdomains. 
RewriteCond ${lowercase:%{SERVER_NAME}} ^\.[a-z-]+\.foobar\.com$
# concatenate the virtual host name onto the start of the URI
# the [C] means do the next rewrite on the result of this one
RewriteRule ^(.+) ${lowercase:%{SERVER_NAME}}$1 [C]
# now create the real file name
RewriteRule ^\.([a-z-]+)\.foobar\.com/(.*) /home/$1/public_html/$2

So when visitor goes to: joe.foobar.com/foo/bar.html, Apache will be
reading: /home/joe/public_html/foo/bar.html.

Is there a way to do this in Cherokee? 

Here's a bit more of information:
http://httpd.apache.org/docs/2.0/vhosts/mass.html

Pablo
-- 
Pablo Fischer Sandoval (pablo [arroba/at] pablo.com.mx)
Cel: (044-55) 2689-6351
Fingerprint:  5973 0F10 543F 54AE 1E41  EC81 0840 A10A 74A4 E5C0
http://www.pablo.com.mx
http://www.jaws-project.com

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Cherokee mailing list
Cherokee@lists.alobbs.com
http://www.alobbs.com/cgi-bin/mailman/listinfo/cherokee

Reply via email to