Advertisement:

Configure Lighttpd for Multiple DotClear Blogs

I took a decision to use the excellent CMS, DotClear, because it is light (which for me means it will run on Lighty without MySQL) and feature rich (which for me means it can handle multiple websites).

This document sets out how to configure Lighty to work with multiple DotClear blogs/sites based on the DotClear blog id. This saves a great deal of time and effort. The DotClear documentation covers how to do it for Apache, here is the method for Lighty. Actually setting up DotClear is not covered here. Please see the documentation on the DC site for that.

Step One

Ensure that the “mod_setenv” module is enabled under the modules section of your Lighty config file. With Debian it's /etc/lighttpd/lighttpd.conf:

 server.modules = (
          "mod_access",
          "mod_alias",
          ...
          "mod_setenv", 
 )

Also ensure that the following modules: auth, cgi, and fastcgi are enabled. In Debian use lighttpd-enable-mod for that, for example:

 # lighttpd-enable-mod fastcgi

Step Two

Install DotClear and ensure it works. In our example we'll assume it's installed in /var/www/htdocs/dotclear.

Once it is installed and the main site works you may add a new site by first creating a symlink in your document root to the DotClear folder:

 # ln -s /var/www/htdocs/dotclear /var/www/htdocs/blog1

Step Three

Add something like this to the host section of your Lighty config file (/etc/lighttpd/lighttpd.conf in Debian):

 $HTTP["host"] == "blog1.yoursite.com" {
  server.document-root = "/var/www/htdocs/blog1"
  accesslog.filename   = "/some/place/wwwlogs/blog1.yoursite.access.log"
  setenv.add-environment = ( "DC_BLOG_ID" => "blog1" )
 }

You may also want to add support for DotClear's clean URLs (see full howto here) so that it looks like this:

 $HTTP["host"] == "blog1.yoursite.com" {
 server.document-root = "/var/www/htdocs/blog1"
 accesslog.filename   = "/some/place/wwwlogs/blog1.yoursite.access.log"
 setenv.add-environment = ( "DC_BLOG_ID" => "blog1" )
 var.dc_base = ""
 
 url.rewrite-once = (
 "^/(admin)/(.*)$" => "/$1/$2",
 "^/(xmlrpc|category|post)/(.*)$" => "/index.php/$1/$2",
 "^/(sitemap.xml|urllist.txt)$" => "/index.php/$1",
 "^/([^\?]*)\.(.*)" => "/$0",
 "^/(.*)$" => "/index.php/$1"
 )
  
 }

Step Four

Create a new blog in DotClear in the admin area under SYSTEM:Blogs: then choose “Creat new blog”.

In the “Blog ID” field put the same value you had entered for the “DC_BLOG_ID” value in the “setenv.add-environment” section above, in our case that would be “blog1”.

Next choose your blog name in the “Blog name” field.

Then put your URL in the “Blog URL” field, in our case: “blog1.yoursite.com”

Next click “save” and your new blog should be working.

That's It

Repeat steps two to four with new values as needed. Such as:

In step two create a symlink:

 # ln -s /var/www/htdocs/dotclear /var/www/htdocs/coolblog

In step three:

 $HTTP["host"] == "coolblog.yoursite.com" {
 server.document-root = "/var/www/htdocs/coolblog"
 accesslog.filename   = "/some/place/wwwlogs/coolblog.yoursite.access.log"
 setenv.add-environment = ( "DC_BLOG_ID" => "coolblog" )

And in step four:

put “coolblog” in the “Blog ID” field and “coolblog.yoursite.com” in the “Blog URL” field and save.

Advertisement:
lighty/dotclearblogs.txt · Last modified: 2012/02/16 02:33 (external edit)
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki Install DokuWiki