Peter's Blog

Redefining the Impossible

Items filed under lighttpd


Nginx? Think 'Engine X' (NOT en-jinx like I keep thinking). It's a web server, one that is very popular in Russia (the first country into space). It can be thought of as a modern, lean mean web server that does away with the bloat of Apache. It is very good for use in VPS's where memory could be at a premium.

I tried it on my new Slicehost VPS and it was up and running in about ten minutes, proxying to my mongrel cluster (which didn't need rebooting when I swapped web servers) like a good'un. The configuration files are very clear and the ubuntu installation is similar to the apache configuration that I am familiar with. It is possible to add a new virtual site in a minute or two, adding a configuration file that is as simple as:

server {
    listen          80;
    server_name     www.domain1.com;
    access_log      logs/domain1.access.log main;

    location / {
        index index.html;
        root  /var/www/domain1.com/htdocs;
    }
}

This is pretty much all you want to state: the name of the site, a path within the site and where it maps to on the file system. For the mongrel proxying I used a recipe I found: the nginx wiki has many such recipes. It reminds me of cherrypy and how most of the recipes on it's wiki were incomplete or broken, something that ultimately contributed to me abandoning turbogears, django and python for ruby on rails.

I was encouraged to see that Nginx can support drupal quite easily as it's url rewriting rules are capable of pleasing drupal's 'clean urls' mode. Lighttpd can support drupal if you do some php hacking.

Nginx doesn't directly support cgi (as a security feature!?!) but it can support fcgi by talking to a fcgi process via a proxy. I haven't tried this yet but it would be the route I would take to support php (if I wanted drupal on my nice box). I would also dearly like phpmyadmin to be available (hidden from the outside world, only accessable through an ssh tunnel of course). My one hope is that such a fcgi php process can support more than one application (can never be sure with these things).

I read more about lighttpd and found mumblings of bugginess in proxying mongrel clusters and some security concerns. I read nothing but good about Nginx.

n.b. unlike lighttpd

/etc/init.d/nginx restart

actually restarted the server (not having to expressly kill the old processes).


Filed under: apache lighttpd nginx


I've got a nice Rails development setup going now. Aptana is a very nice IDE, very powerful, very rich. The Rails development aspect is most useful in being able run applications in development mode on my PC. I use the mysql server on the deployment server through an ssh tunnel rather than install a database on the PC.

I have created a subversion repository on my VPSlink server. I have installed the subclipse plugin on Aptana and checked out my application onto the work PC. I work on the application in Aptana, polish it and when it is ready I commit the changes again through Aptana. Then on my server I deploy the code by getting the new version out of subversion. I don't use a simple rsync to deploy and I haven't got into capistrano (the rails deployment tool) going via svn works for me. I might consider putting up something like trac (or a rails based alternative) to give me a development wiki and web browsing of the repository.

I've been thinking about backups and the current plan is to backup the SVN repositorys and mysql dumps from my VPSLink server to my site5 server and vice versa. The VPSLink stuff is more in need of backing up since I am the administrator of that one, the site5 account includes daily backups. I was tempted by rsync.net a nice, simple, flexible and cheap remote backup option but since I already have two accounts with ssh access and 35G of space between them I don't think I need to spend more money. Rsync.net looks appealing but the main thing it is lacking for professional purposes would be Windows file permissions, otherwise I might consider it for backing up the servers at work: being able to recover all ones files is good, not having to spend a week fixing the spaghetti mess of windows access permissions is better.

One major change is that I have reverted from Lighttpd back to Apache on my VPSLink server. The main reason for this was that Lighttpd seems to have some limitations in terms of supporting things like drupal's urls. Lighttpd would be good for simple setups but getting multiple legacy php and rails applications set up is just as troublesome as with Apache so I've gone back to the devil I know.

I've had Apache fail to start with memory errors a few times. This could well be the 500M limit of the VPSLink coming into play. VPSLink is cheap because there is no swap, 500M is my absolute limit. If I start getting memory problems I will have to consider the options:

  • I can upgrade the VPSLink to 1G memory but for similar money I could get a cheap dedicated server
  • I could get a different VPS account, one that had burst memory (it's the bursts that kill VPSLink) but I do like the performance of VPSLink.
  • I could fiddle about tuning the number of apache processes and suchlike but life is too short for that one

This blog is still on the site5 account. The server is being upgraded soon, maybe this will resolve the loading issues it has whenever I try doing some development on it (e.g run 'top' and shriek in horror).