Slicehost Setup: Ubuntu + Nginx + PHP + MySQL

Running Apache on my 256MB slice was not fun. I kept getting “swap” warnings from slicehost, and some mornings I wake up to find my server hung.

So I decided to re-install fresh and run Nginx with PHP.

Installing Ubuntu (Jaunty), Nginx, PHP, and MySQL is easy following the slicehost guides: http://articles.slicehost.com/ubuntu-intrepid

The hard part is getting Nginx to work with PHP — You have to enable PHP-CGI.

There are bunch of tutorials out there on how to achieve this, but the most SIMPLE one is here: http://tomasz.sterna.tv/2009/04/php-fastcgi-with-nginx-on-ubuntu/

Two small changes:

PHP_FCGI_CHILDREN=5
sbin/start-stop-daemon --quiet --start ....

running PHP_FCGI_CHILDREN at 15 causes the server to overload, but running 5 seems to work fine. Also, the start-stop-daemon is inside the sbin.

Been running this blog and four other sites on this setup for about a week now. It is way snappier than before on Apache.

  • Eric

    Hey great help… but do you know how to update mysql from the default to something else? I can’t find any guide on it… any help will be great

  • Marcccc

    I have similar problem and support at http://onexenvps.com helped me a lot.