Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apache or lighttpd [closed]

For development, I use a local LAMP stack, for production I'm using MediaTemple's Django Container (which I'm loving BTW). MT's container uses lighthttpd. Honestly I've never had any other experience with it. I've always used Apache. I've been doing some reading:

  • Onlamp
  • TextDrive
  • Linux.com

Here's are questions:

  • What strengths does one have over the other?
  • Would it benefit me to use lighthttpd on my dev setup?
  • What's up with using both? The Linux.com article talks about using lighttpd with Apache.
like image 668
imjoevasquez Avatar asked Oct 05 '08 15:10

imjoevasquez


People also ask

Is lighttpd Apache?

Apache is a very featureful and extendable webserver. In most instances, you would want to use Apache. Lighttpd is smaller and quicker, because it doesn't have all the features that Apache does. You would want to use it on a very large scale website.

Is Lighttpd is a web server?

lighttpd (pronounced "lighty") is an open-source web server optimized for speed-critical environments while remaining standards-compliant, secure and flexible.

What type of server is Lighttpd?

Lighttpd is an IPv4 and IPv6 compatible Web server that understands HTTP/1.0 and 1.1, HTTPS (using OpenSSL) CGI/1.1, native FastCGI, and HTTP authentication.


2 Answers

The benefit of both: Apache is more powerful and extensible (useless if you don't need that power, but anyway...) and lighttpd is faster at static content. The idea is of splitting your site into static content (css, js, images, etc) and dynamic code that flows through Apache.

I'm not saying you can't do a lot with lighttpd on its own. You can and people do.

If you're using lighttpd exclusively on your production server, I would seriously consider mirroring that on your development and staging servers so you know exactly what to expect before you deploy.

like image 56
Oli Avatar answered Sep 29 '22 21:09

Oli


For purely static web pages (.gif, .css, etc.) with n http requests from distinct ip addresses: 1. Apache: Runs n processes (with mod_perl, mod_php in memory) 2. lighttpd: Runs 1 process and 1 threads (You can assign m threads before launching it)

For purely dynamic web pages (.php, .pl) with n http requests from distinct ip addresses: 1. Apache: Runs n processes (with mod_perl, mod_php in memory) 2. lighttpd: Runs 1 lighttpd process thanks to async I/O, and runs m fast-cgi processes for each script language.

Lighttpd consumes much less memory. YouTube used to be a big user of lighttpd until it was acquired by Google. Go to its homepage for more info.

P.S. At my previous company, we used both with a load balancer to distribute the http traffic according to its url suffixes. Why not fully lighttpd? For legacy reasons.

like image 33
yogman Avatar answered Sep 29 '22 21:09

yogman