Latest News >> 2008-07-20 2008-06-25

I’ve been completely fed up with news/feed/rss/atom readers these days. I use Linux as my primary operating system, and I only have a few feeds that I want to rip through quick so I can get to reading the content. Yet, trying to find a reader that doesn’t suck donkey balls has been a chore.

2008-06-21

Wanna know what all the Ruby vulnerabilities are? Or at least have a fun look at how to search through code for clues? It’s a blast.

2008-06-13

I’m dropping a large blog post on everyone to just say that I haven’t died, I’ve just been busy working on my book for A/W about Mongrel. I had contracted with them to do a book about deploying Mongrel, but then decided it wouldn’t be a very good book since we’d already done one about that topic and there wasn’t too much more to say.

Apache Configuration

First off, you’ll need to have Apache2 installed for these instructions. Apache1 does work, but it’s only been tested on win32 as working. I imagine the configuration isn’t too different though.

This configuration information is based of jkraemer’s instructions where he used Debian. You’ll probably have to modify it for your system.

Request For Help

I’m currently looking at creating a Rails generator that will give you good configuration files for lighttpd and Apache which you can include into your configuration. I’m looking for anyone that has a good solid configuration for Apache with instructions.

Required Software

Here’s the stuff you need:

If you want the latest mod_scgi source that has the AJAX bug fix then you can grab it from the downloads as scgi-ajax_fix.tar.bz2 or get it from the CVS. Win32 people can get precompiled mod_scgi binaries with the fix at the downloads directory.

Apache SCGI Module

After you’ve installed SRR you need to install the mod_scgi module. The instructions should be something like this:

cd scgi-1.7/apache2 apxs2 -i -c mod_scgi.c

After this you need to install the module in your Apache install. On some systems this is done with a2enmod scgi from the above directory. Your system may be different.

Apache Configuration

You next need to configure the httpd.conf file or to add a virtual host file. The most basic configuration file you can make is available in the source distribution as a /downloads/scgi_rails/httpd.conf sample.

In this file I’ve basically added the line:

LoadModule scgi_module lib/apache/mod_scgi.so

After all the other LoadModule lines, and then this at the end:

SCGIMount / 127.0.0.1:9999

Doing that gives you the most basic setup where everything goes to the Rails application. Still not a perfect setup though since this means Rails is serving everything (I think).

More Complex Virtual Host

Here is the configuration from jkraemer’s configuration that works on Debian, but I haven’t tested it on other systems. On Debian you put this in a file named /etc/apache2/sites-available/yourdomain to get the virtual host setup.

<VirtualHost your-ip:80>
    AddDefaultCharset utf-8
    ServerName www.yourdomain
    DocumentRoot /your-switchtower-root/current/public
    ErrorDocument 500 /500.html
    ErrorDocument 404 /404.html
    # handle all requests throug SCGI
    SCGIMount / 127.0.0.1:9999
    # matches locations with a dot following at least one more characters, that is, things like   *,html, *.css, *.js, which should be delivered directly from the filesystem
    <LocationMatch \..+$>
        # don't handle those with SCGI
        SCGIHandler Off
    </LocationMatch>
    <Directory /your-switchtower-root/current/public/>
        Options +FollowSymLinks
        Order allow,deny
        allow from all
    </Directory>
</VirtualHost>

Special Thanks

Thanks to jkraemer for getting stuff working with Apache2 and posting his configuration. Please let me know how this works for you, and if there are any changes needed for other platforms (because we all know that Debian just has to do everything different).