If you visit DrBrett.ca you now get the splash screen that points to the various subdomains I currently have set up (which is not very interesting since one is my password-protected todo list and the others redirect to my two blogs). This is all thanks to finally getting lighttpd up and going.
This actually turned out to be a little trickier than I would have liked. The docs are not very extensive. Pretty much the only docs are the syntax of the files, a listing of variables and modules, and an example file. Luckily I have done enough DSLs (domain-specific languages) that I could read the syntax explanation without trouble. And after staring at enough example configuration files and reading the docs on every extension module that I thought I might care about I figured out what I wanted. But I had to write some very detailed comments in my configuration file to get all the info together in one place to be able to write my configuration file.
But then the next trick was getting lighttpd to run. I downloaded the source (no package in Ubuntu Hoary), compiled it, and then ran lighttpd's syntax checker against my configuration file. It said there was an error, but it wasn't very clear as to what it was. Not feeling like dealing with a crap error message right then and there, I just commented out the offending lines and tried again. That passed the syntax check.
But then when I ran lighttpd it complained about not being able to compile a basic regex. Since it was not a part of the basic setup but for some fancier stuff, I figured I would wait on dealing with that warning until I could at least get drbrett.ca to return the proper index file.
But drbrett.ca did not work; it downloaded the HTML file as an octet stream. That's when I bothered to include the MIME types mapping that most lighttpd configuration files had. You would figure it could at least have a reasonable default for HTML, but I guess not. Then at least www.drbrett.ca hit my index.html file.
But drbrett.ca was coming up blank. At first I thought I had botched some DNS setting somewhere. But then I decided to start stripping out all of my fancy parts of my configuration file and work my way up. Then suddenly all of the subdomains went to my index.html file.
Then I began to add bits one by one. First I added a rule against hitting the drbrett.ca host so that I could have a private directory that did not have a directory listing. This required using a regex to match against the URL "^/private". Well, that crapped out specifically when lighttpd told me that pcre support was not available. Now I knew why "^/(.*)" was not being compiled as a regex.
So, after just being miffed that the docs no where said that pcre was required nor any warning from configure (although I realized later there is a list of modules that do get supported based on what configure finds that can let you know), I used apt-get to get the pcre development files. After a recompile, I was in business.
After that I added in my redirects that I originally had and they worked fine. Once again the lesson has been learned that XP already taught me; only put in what you need to start and then build from there. Failures in a smaller setting are much easier to debug than ones in a larger setting.
I plan to have a section in my personal site where I put up various configuration files (vim, zsh, ssh, etc.) for people to download. Gives me an easy place to get at them when I am on a new machine, but they are also heavily commented so hopefully someone can get help with them. I will also toss up my lighttpd configuration file as well when that part of the site gets done.
The next step for me is to tackle the FastCGI support for Django. That way I don't need to fake things with a redirect to another port but can have a FastCGI server running that gets hit with possible URL rewriting. That is going to require figuring out how to configure Django for it (seems to be decent docs for that), getting lighttpd to hit in the base case, and then seeing how to get a URL rewrite to hit the server (whether a single rewrite rule to www.drbrett.ca will get picked up by another host matching rule that sends the request to Django or if I need to have Django hit explicitly for every rewrite rule). Hopefully it won't be too painful.