Apache2 alongside lighthttpd or nginx?

Discussion in 'Server Operation' started by talkingnews, Mar 10, 2011.

  1. talkingnews

    talkingnews New Member

    Here's my situation:

    At the moment, I'm quite happily running apache2, mysql, php 5 etc and some required apache mods (rewrite, headers, expire, deflate etc) plus mod-pagespeed which appears to be working well.

    All this is quite happy within the confines of a 512Mb RAM Ubunutu 10.10 VPS with current and future expected traffic levels.

    BUT... at some point soon, I'm going to be installing an image cache and serving 80Mb audio files. A pre-written php class takes a folder of images, resizes them to two smaller sizes, and dumps them in subfolders, and it's THESE images which get served up.

    Have I understood correctly that each time apache is required to serve a file, it needs another micro "instance", complete with all the memory of loading all the mods, and when the connection is closed, that instance is freed?

    So, where I have "keepalive" set to 2 seconds and my page always loads within 1 second with a few 25kb images, it's fine now.

    BUT... let's say the page loads, then someone starts listening to the 80mb file of 1 hour (or downloads it, say 20 minutes) does that mean that apache instance and chunk of memory is "used" for all that time?

    Therefore, when I read about lighthttpd and nginx being good for having "tiny" footprints, is it feasable to go down the road of excluding apache2 from serving certain subdirectorys, and force one or other of these "micro servers" (any preferences out there?) to serve the file, freeing up the big beast of apache to serve more "main" dynamic pages?

    Does all that make sense? I'm at the stage where the more I read now, the more conflicting views there seem to be. (The option of "get more memory" is not viable at the moment).
  2. falko

    falko Super Moderator ISPConfig Developer

    That is true.

    We use lighttpd for static content only, and it is very fast. In addition to that, if you serve your pages from two hosts (e.g. PHP/HTML from Apache and images, CSS, JAvascript from Lighttpd), it will make your pages load faster because browsers are configured to download only two files from one host in parallel. So if you use two hosts, browsers can download four files in parallel instead of just two if you just used one host (in fact, you can trick browsers by creating CNAME records that in fact point all to the same host, but that's another story).

    But I can't say if it makes sense to use Lighttpd or nginx in your case because you don't serve static files (if I understood you right, your files are generated dynamically). You'd have to try it and see if it makes a difference.
  3. erosbk

    erosbk New Member

    Falko, is there any problem to use lighthttpd + apache while using ispconfig 3? is there a how to or tutorial? I want to use lighthttpd for static content, and if not, just bypass them to apache2... but I want it for every vhost, and transparent for ispconfig! is it posible?

    Thanks for your help! (does it really worth? my web/deb only server es xeon 3440, 4gb mem, 900gb hdd)
  4. falko

    falko Super Moderator ISPConfig Developer

    ISPConfig 3 does not support lighttpd, so it is at your own risk if you want to use it. I can't say if/how this works.

Share This Page