Setting up and securing web server (+MySQL +Rails/PHP) on Ubuntu 10.04 LTS

After repeating these operations many times in various setups, I decided to create a public set of instructions and share them with the world. This should be suitable for most of the simple web sites, utilizing Ruby on Rails or PHP.

The setup works on Ubuntu 10.04 Server LTS (scheduled end of life April 2015). Other components of the setup are Nginx as the web server, Phusion Passenger as application server.

I’m using this setup most often on Linode VPS, however none of the instructions are Linode specific.

Continue readingSetting up and securing web server (+MySQL +Rails/PHP) on Ubuntu 10.04 LTS

Installing Flash player browser plugin in 64-bit Ubuntu 11.04

I got a new hard drive for my laptop and decided to make a leap of faith and move to 64-bit version of Ubuntu, since I had to install a fresh system anyway. In case you didn’t know – Adobe doesn’t have stable Flash player version for 64-bit Linux. Adobe Labs offer preview release codenamed …

Increasing Ruby interpreter performance by adjusting garbage collector settings

According to Evan Weaver from Twitter it is possible for a typical production Rails app on Ruby 1.8 to recover 20% to 40% of user CPU by simply adjusting Ruby garbage collector settings. In August I set out on a quest to verify that statement on HeiaHeia servers. Results have really exceeded my expectations. Time to execute application tests locally decreased by 46%. On production servers CPU utilisation decreased by almost 40%.

Call to undefined function: imagecreatefromjpeg()

While installing new Joomla modules I came across this PHP error (yep, still have to deal with PHP occasionally). I had PHP compiled from source on Ubuntu 10.04 as per earlier instructions. Quick check of phpinfo() indicated that while gd module was compiled in, it didn’t have JPEG support: GD Support enabled GD Version bundled …

Running Rails applications using Nginx with Passenger on Ubuntu Server

If you’re planning to run Rails applications on Nginx using Phusion Passenger, and do it on Ubuntu Linux, here’s what needs to be done.

Even though there’s Ubuntu nginx package available (which works perfectly when you’re running PHP apps using FCGI), if you want to take into use Phusion Passenger, you’ll need to recompile Nginx from sources.

Instructions below were verified on Ubuntu 10.04 (Lucid Lynx) Server Edition.

Continue readingRunning Rails applications using Nginx with Passenger on Ubuntu Server

Moving Joomla, WordPress and other PHP/FastCGI apps to Nginx

Have you moved your site from Apache to Nginx and now your FastCGI (php-cgi/spawn-fcgi) processes die/hang/crash periodically and your users see “HTTP 502 Bad gateway” or “HTTP 504 Gateway timeout” instead of a website?

I have faced this problem and found a relatively simple and robust solution. Here’s how I did it on Ubuntu 9.10 (Karmic Koala) and 10.04 (Lucid Lynx) server edition.

Continue readingMoving Joomla, WordPress and other PHP/FastCGI apps to Nginx

Setting up your own git server on Ubuntu

This will create a new user ‘gitosis’ and prepare a structure for repositories in /srv/gitosis. Now let’s initialize a gitosis-admin repo – it is used for managing repositories and access

Of course there’s always an option to use github. And if you’re working on an open source project, or want to concentrate on coding and not system administration, github is a lot better option than setting up and managing your own git server (I’ve been so impressed by @defunkt‘s presentation on #frozenrails, that started recommending github to everyone 🙂 But if you already pay for a virtual machine somewhere (like Linode), then setting up your own git server might be a viable option, especially that it is sooo easy.

The following instructions have been verified on Ubuntu 10.04 Lucid Lynx, but should work at least on Ubuntu 9.04 and 9.10 just as well.

Continue readingSetting up your own git server on Ubuntu

No space left on device – running out of Inodes

One of our development servers went down today. Problems started with deployment script that claimed that claimed “No space left on device”, although partition was not nearly full. If you ever run into such trouble – most likely you have too many small or 0-sized files on your disk, and while you have enough disk space, you have exhausted all available Inodes. Below is the solution for this problem.

Continue readingNo space left on device – running out of Inodes

Upgrading iPhone firmware using VMWare and Ubuntu 9.04

This was the second time I upgrade firmware on my iPhone, and second time I ran into the same problem.  In the middle of the update iTunes reports “Unknown error” and iPhone dies (well, goes into recovery mode, but it is not much help). If that happened to you, don’t panic! To make this geeky combination (Ubuntu 9.04, VMware, iTunes and iPhone software update) work, there’s a little trick you need to do. Continue readingUpgrading iPhone firmware using VMWare and Ubuntu 9.04