Multiple Rails Apps Under Passenger

My development server is on a home LAN behind a firewall, and I don’t want to make it a DNS sub-domain. I have directed my router to issue fixed IP addresses through DHCP, so I can use the IP address as part of the URL. Setting up multiple Rails applications is pretty easy, but if you want to mix the Rails environments (developement / test / production / custom), you need to use <Directory> to configure each Rails app: By using <Directory> you can change the behavior of each of your Rails applications as needed, including the ability to disable Passenger for non-Rails code (such as the blog shown in… Read More

Continue Reading

Rails and PHP under Ubuntu Apache

I have Ubuntu 9.10 (aka Karmic Koala) running on my laptop. It’s rapidly becoming my portable development machine, so I set up the Rails environment right away. I have decided to add PHP to the development mix, so I began to install all the PHP stuff using Ubuntu’s built-in Synaptic Package Manager found under System -> Administration. That worked fine, but oddly enough, the package manager uninstalls the Phusion Passenger module for Apache2. Huh! Here’s the executive summary to get Rails and PHP to coexist on a Ubuntu Apache server: Install all the PHP goodies Install the Passenger gem Run passenger-install-apache2-module to compile the Passenger module Add the Passenger LoadModule… Read More

Continue Reading

HAML and Apache Encodings

I’m playing around a bit with the HAML gem. It broke my Apache / Passenger server immediately. The original error message looked something like: /!\ FAILSAFE /!\ 2009-05-01 10:05:18 -1000 Status: 500 Internal Server Error invalid byte sequence in US-ASCII Google to the rescue. On Linux machines, you should have a /etc/sysconfig/httpd file. I added HTTPD_LANG=en_US.UTF-8 and all was well after restarting Apache. This took awhile to find, so here’s the URL to the Rack Development Google Group, of all places. There is some info on OSX as well. http://tinyurl.com/m8oxnz Google has added at least 10 points to my IQ. Make that 20 points.

Continue Reading

Apache Through the Firewall

Back in the old days (pre-2000), the various flavors of UNIX had very little security other than the “baked-in” stuff such as encrypted passwords, root vs normal users, the standard file permissions, etc. Later, things like SELinux and firewalls were added. I still get tripped up on that occasionally. I recently moved my Rails apps from the mongrel-based server model to Phusion Passenger (documented in a previous post). This worked fine, but it was time to let all the machines on my home network see the web sites, if only to see what they look like on Windows PCs. A Google search shows that a lot of people have trouble… Read More

Continue Reading

Configuring Passenger sub-URIs

Passenger sub-URIs allow you to run multiple Rails aplications under one Apache virtual host, which is great for development. Although Phusion has documented how to do this, I was having trouble. Eventually I got it to work, by doing the steps below: The Apache default DocumentRoot location is /var/www/html. I created a new directory and changed DocumentRoot to /var/www/public As root, cd /var/www/public. Add a link to each public directory of each Rails app to be accessed. On Linux, this looks like ln -s /somewhere/MyApp1/public MyApp1, where MyApp1 was created by running rails MyApp1 under the directory /somewhere Modify the Apache httpd.conf file. DocumentRoot was changed as shown in Step… Read More

Continue Reading