Recompile PHP with Postgres support in OSX »

Created at: 09.08.2011 09:31, source: Hackido, tagged: apache2 php mac postgres



more »

Moving to Ruby Enterprise Edition »

Created at: 16.01.2010 23:43, source: Hackido, tagged: ruby rails apache2

I use Phusion Passenger for all my production stacks these days. But I'm still using plain old Ruby 1.8.7 in production despite the well documented performance improvements provided by Ruby Enterprise Edition. Today was the day I decided to take the plunge.. I have a 1GB stack on Slicehost and noticed some swapping, an indicator that the 33% reduction in memory use would be really helpful. If you decide to undertake this as well, I have a few warnings..


If you followed the directions and the subsequent instructions provided by the installer to update your apache conf, you'll notice something almost immediately:

Your app doesn't work.

Why? Well, you installed a new version of Ruby so you'll need to reinstall your gems too. Good news is that if you've added your config.gems in your environment.rb you should be ok and it can be much faster. First though, I'd highly recommend making some symlinks. This will allow rake tasks to continue to work without adding a giant prefix. Thanks to this blog entry from Webficient:

sudo ln -fs /opt/ruby-enterprise-1.8.7-2009.10 /opt/ruby-enterprise
sudo ln -fs /opt/ruby-enterprise/bin/gem /usr/bin/gem
sudo ln -fs /opt/ruby-enterprise/bin/irb /usr/bin/irb
sudo ln -fs /opt/ruby-enterprise/bin/rake /usr/bin/rake
sudo ln -fs /opt/ruby-enterprise/bin/rails /usr/bin/rails
sudo ln -fs /opt/ruby-enterprise/bin/ruby /usr/bin/ruby


After that you should be able to do a regular sudo rake gems:install, but if not you'll have to reinstall your gems with the full path prefix. e.g.:

sudo /opt/ruby-enterprise-1.8.7-2009.10/bin/ruby /opt/ruby-enterprise-1.8.7-2009.10/bin/gem install will_paginate


I'll be keeping an eye on performance but so far I like what I see. If you are tempted to do this upgrade, I highly recommend you make sure your stack is up to date (both binaries and gems) and that you've backed up everything. Good luck!


more »

Quick Tip: Auto enter password for your SSL Certificate in Apache2 »

Created at: 29.10.2009 16:56, source: Hackido, tagged: apache2 ubuntu

If you've got an SSL certificate that you're using that happens to be protected with a passphrase, you know that you need to enter that password every single time you restart your web server. Since Linux is so stable these days it's hardly a big problem, but if something goes wrong while you're on vacation or away from your computer, it could become a big deal. One solution is to remove the passphrase from your ssl certificate so that Apache doesn't ask you for it. But there's another way too.


Basically it boils down to creating a file with your passphrase in it and then pointing apache to it. Since we love Ruby around here, we'll show you how to create the passphrase script using it.

#!/usr/bin/ruby
puts "passphrase"


Save that somewhere and then add this to your /etc/apache2/httpd.conf file:

SSLPassPhraseDialog exec:/path/to/passphrase


Lastly, let's make sure that file is executable:
sudo chmod +x /path/to/passphrase


That should be it. Let's stop apache and then start it again:

sudo apache2ctl stop
sudo apache2ctl start


If all went well, you weren't asked for a passphrase and your apache server is still running!

There are some disadvantages though. One of the biggest reasons to put a passphrase in your ssl cert is to prevent it from being hijacked. If a cracker can get into your server and take the cert he/she might be also able to get your passphrase file. That's no good. So be sure to put your passphrase somewhere secure and protect your server.


more »