Apache with Coldfusion, PHP, and ruby on Ubuntu

This is for setting up everything to appear under http://localhost/, i.e. http://localhost/phpmyadmin and http://localhost/redmine. I did it “properly” with aliases (mostly) and stuff.

I don’t know if anyone else would want this crazy set up, but here it is for posterity.

First install apache2 with sudo apt-get install apache2. Test it out in http://localhost/. If it says it works, it works.

Download Coldfusion from the Adobe site. MX7 supposedly has kinks with installing on Linux, so get 8 or 9. I’m using 8. chmod u+x the binary and then run it. Follow the prompts and let it configure apache for you; don’t use the standalone server. The standalone server probably eats resources like mad, though I eschewed it mainly for sanity since I wanted apache to do it all. Feels less dirty.

sudo apt-get install php5. Then aptitude search php | grep apache to get the necessary mods if it’s not installed already.

sudo apt-get install ruby rubygems ruby-dev and also look through aptitude for the necessary mod. You need the ruby-dev to install stuff later with gems.

I’ve stuck my project files in my homedir because I prefer easy access from my homedir. Some peeps say this is not as safe, but for local sandboxy development it’s grood.

Now lets install us some gems. sudo gems install passenger come to mind, and install whatever else it says you need. If it installs stuff to your ~/.gem folder because you didn’t call it with sudo, rm -rf .gems and redo it properly this time, you nonce.

Now to put it all together in your /etc/apache2/ confs:

The CF installer should have written something to the httpd.conf. Again, for sanity’s sake, I moved this into its own file in conf-available then symlinked it in conf-enable.

In the now-blank httpd.conf, put in:

LoadModule passenger_module /var/lib/gems/1.8/gems/passenger-2.2.15/ext/apache2/mod_passenger.so
PassengerRoot /var/lib/gems/1.8/gems/passenger-2.2.15
PassengerRuby /usr/bin/ruby
DirectoryIndex index.phtml index.php index.php3 index.shtml index.html index.htm index.cfm

And rig up the necessary aliases in sites-available/default:

RailsBaseURI /redmine
<Directory "/var/www/redmine/">
        Options Indexes ExecCGI FollowSymLinks
        Options -MultiViews
        AllowOverride all
        Order allow,deny
        Allow from all
</Directory>

Redmine was the only one that I couldn’t get to go just with an alias, so I cheated and symlinked to its ‘public’ directory in /var/www/. I’m not sure why. Ruby had some other fussiness as well. I can’t remember what exactly, though. Just pushed it around until it worked. Look around on google if it gives you error messages; ruby’s good for that. Check stuff inside /var/logs/apache2/error.log to see if you can get more details.

Alias /cf/ and /cf to your coldfusion apps directory. Same goes for your php apps, like my phpmyadmin, which can be symlinked from /etc/phpmyadmin/apache.conf.

Comments are closed.