|
![]() |
Apache ConfigurationFirst 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 HelpI’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 SoftwareHere’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 ModuleAfter you’ve installed SRR you need to install the mod_scgi module. The instructions should be something like this:
After this you need to install the module in your Apache install. On some
systems this is done with Apache ConfigurationYou 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:
After all the other LoadModule lines, and then this at the end:
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 HostHere 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 ThanksThanks 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). |