Back to rails after 6 months
I haven’t done any programming in Rails since about June, most of my time has been spent on the perl innards of Quest Atlantis where I’ve been changing a lot of the code in preparation for my dissertation, and to handle some performance issues that were killing us.
Getting back to rails hasn’t been easy, its a different way of thinking for me than perl–which is good. But with rails I always want to be principled. So I started out writing tests, trying to use them to help me work through a very incomplete design I was handed. But the upgrade to rails 3.0.3 hasn’t been smooth, in part because a lot of bits are rapidly changing given the relative newness of rails 3 and the libraries I’m using in this project.
But the big thing is that I just figured out the way to have nginx-passenger serve the new app I’m working on via a base_uri and still pass through all the other non-static requests to the apache instance running mod_perl. Since the passenger documentation contains errors and was unclear for me, I’m sharing this here in case someone else needs it.
The config I ended up with is:
server { listen 8000; server_name rails.crlt.indiana.edu qaperl.crlt.indiana.edu; root /var/www/www_home; location ^~ /foo_bar { passenger_enabled on; rails_env development; # for this config to work: # ln -s /path/to/foo_bar/public /var/www/www_home/foo_bar root /var/www/www_home; passenger_base_uri /foo_bar; # break is not necessary because of the ^~ match } # If a specified static file type exists as named, serve it up directly location ~* \.(jpg|jpeg|gif|png|css|js|zip|)$ { root /var/www/www_home; if (-f $request_filename) { break; } } location / { proxy_pass http://127.0.0.1:8010; break; } } passenger_pre_start http://127.0.0.1:8000/;