Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

i frequently install an apache on my local PC so as to test files or experiment with hosting right at my PC. The server i used is usually Apache. Is there any reason to try other ones like lighttp or nginx?

share|improve this question
add comment

5 Answers

up vote 4 down vote accepted

For the vast majority of people, Apache provides more than enough performance, features and flexibility. Just spend an evening or two perusing the Apache Documentation To get a sense of the wealth of features.

I have a colleague who worked at shopping.com who said they built an entire company on mod_rewrite

There are some corner cases where alternative web servers do make sense - typically in ultra-high performance and large-scale hosting environments, and, conversely, in situations where you may be memory limited (such as a slicehost/linode VPS)

Advantages of the various alternative web servers:

  • lighttpd - well known for managing to serve large numbers of connections (as many as 10,000)
  • nginx - works well in limited memory configuration.

    In general, if Apache isn't causing you any difficulty, you have all the features and functionality you need. On the flip side, if you are trying to squeeze a few thousand simultaneous connections out of a 256 MByte VPS - you may want to consider checking out nginx.

  • share|improve this answer
    add comment

    It depends on website type, load, content type etc. nginx and lighttpd have high performance and small memory/cpu footprint. In general, if your site serves only static content (pictures, media etc, no dynamic pages as php) and it has lots of simultaneous connections - nginx or lighttpd may be a better choice. apache is a versatile but more heavyweight web server, it's highly configurable and you can serve any type of content with it.

    An interesting and extremely useful application of nginx/lighttpd is proxying an apache server behind them. In this case nginx (or lighty) accepts connections from users and also serves static content directly to them, but sends queries for dynamic pages (php, cgi etc) to apache. Thus apache only processes dynamic pages and sends them back to proxy (nginx, lighty) which in turn simply serve them to users. This scheme is very effective on high-load sites.

    But in general i'd agree with ghs0 - in most cases "you have all the features and functionality you need" with apache.

    share|improve this answer
    add comment

    I have a virtual server with 256M RAM. To host my PHP application and save on RAM, I decided to go with lighttpd/PHP-fcgi instead of Apache/mod_php. In my current setup I have 6 PHP processes (sweet-spot for 4 core CPU) handling the request which a single lighttpd process dispatches to them. So the memory usage always stays flat, no matter how many users come the the site. Although I did no load tests, it wouldn't surprise me if this setup could handle a slashdotting. As a bonus, there was some RAM left for memcached.

    Lighttpd is pretty full-featured. It starts the fcgi processes on startup, closes them on shutdown (which ngingx doesn't), has mod_rewrite and tons of other goodies. On top of that the configuration-file is way more powerful than Apache's.

    Granted, given enough time I think you could configure Apache to something like this as well but I guess it would be no fun and probably use more RAM.

    share|improve this answer
    add comment

    I was very, very pleased with lighttpd/fast-cgi on my old webserver, which was a Pentium II at 500Mhz with 192MB of RAM. With apache I was routinely 200MB into swap file, whereas lighttpd/fast-cgi almost never forced the system to touch swap.

    If you've got the RAM and processing power to handle Apache, and you already have experience with it, no, I doubt there's any pressing need for you to change. If you're looking for something more lightweight that's Apache-like and covers a good range of webserving applications (although not quite the plethora that Apache has), lighttpd with fast-cgi is an excellent option to look into.

    share|improve this answer
    add comment

    lighttpd's config is quite nice and straightforward, e.g. there's no magic around VirtualHost, you just write if that tests HTTP_HOST header and put rules in it.

    lighttpd has mod_rewrite which is a bit less powerful than Apache's, but much easier to use (rewrites just once).

    When basic rewrite doesn't cut it, lighttpd has mod_magnet which lets you write rewrites in Lua. It took me less time to learn Lua than to debug average mod_rewrite problem on Apache :)

    lighttpd also has mod-trigger-b4-dl and X-lighttd-sendfile, both of which allow you to easily implement file access with custom authentication mechanism (e.g. PHP script that protects collection of documents, with lighttpd efficiently handling sending of the files).

    Apache+mod_php has annoying problem with gettext, which caches .mo files until server is restarted. I haven't got that problem with lighttpd.

    share|improve this answer
    add comment

    Your Answer

     
    discard

    By posting your answer, you agree to the privacy policy and terms of service.

    Not the answer you're looking for? Browse other questions tagged or ask your own question.