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.