Installing modporter for Rails on Ubuntu Hardy Heron

[tweetmeme]
It’s not an uncommon scenario for Apache to not play nicely with Rails when dealing with multipart forms and large uploaded files. There are a few solutions out there, but the best we have seen is modporter from the guys at ActionRails.

So, you’ll need a few things to beef up Apache; if you haven’t got them already:

sudo apt-get install libapache2-mod-apreq2
sudo apt-get install libapreq2-dev
sudo apt-get install apache2-threaded-dev

Now fetch the latest ModPorter from github from here. Once you have downloaded and unpacked this, edit the Rakefile and change the apxs variable to apxs2, then type:

cd modporter-directory
rake

And, you’ll probably want the modporter plugin for Rails to give you a nice consistent interface for uploaded files rather than differentiate String IOs and UploadedFile objects.

If you have git:

script/plugin install git://github.com/actionrails/modporter-plugin.git

Otherwise, download the tar from here, unpack and stick in your vendor/plugins directory.

Now configure Apache to use load some additional modules, edit your apache.conf file to include (your path to modules may be different):

LoadModule apreq_module modules/mod_apreq2.so
LoadModule porter_module modules/mod_porter.so
Advertisements