Macha

VPS

March 09, 2010 | categories: Me, Programming

During the last week, I finally did something I've been meaning to do for the last while, and bought myself a VPS as up until now, I've been on shared hosting. On the advice of compwhizii, I went with Linode. While there was nothing wrong with my previous web host, Web Hosting Buzz, they were a full $5 a month dearer for their entry level VPS packages, and unlike Linode, did not give you a choice of a UK data centre. My site, and most of it's visitors are in Europe, so that was quite helpful.

So, after purchasing the VPS, I set it up with the basics: DNS, Apache, MySQL, PHP (my blog runs on Wordpress which uses PHP, which is why it got in ahead of Python). Very simple, just use the package manager and Control Panel to set it up. There was a slight mishap where my DNS changes were propagated before I fixed them, leaving my blog not set up yet. But that was soon resolved.

After about a day, I noticed Apache was getting random segfaults serving static pages. Rather than spending ages to debug the problem, I decided to try out nginx, which I had heard good things about. It was quite simple to set up, with Linode providing a guide with most of the steps. All well and good. Until, about two days later, nginx started reporting a 502 bad gateway error. A problem with a new web server? Nope. The fault lies with php-cgi, and it was compwhizii's blog to the rescue again. His post about using nginx provided a link to this page explaining how to solve it. The short version? Set the  PHP_FCGI_MAX_REQUESTS environment variable, so the php-cgi process gets restarted every so often.

The VPS is, unsurprisingly much better than the shared hosting. SSH is much better for administration than the old Control Panels. The first project I'm doing to really make use of that, is something I have planned using Django. More on that later, if it comes to anything.