Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I was wondering which is the best webserver that would be able to server static content with the highest performance, and also is able to perform load balancing.

I looked into apache, lighttpd, nginx, and cherokee, but I am not sure which one would be my best option as a load balancer.


share|improve this question
As soon as you use the word "best" you're just asking for the question to be closed as too subjective. – John Gardeniers Jan 7 '11 at 4:11
I am discussing pros and cons for each of these servers, and definitely there will be a "best" solution in my specific case. – wael34218 Jan 8 '11 at 11:56
up vote 4 down vote accepted

As others have mentioned, its not advisable to use a webserver as a load balancer when you could use a load balancer as a load balancer :)

Here's another option for you - since its just static files, have you considered using a content delivery network (CDN) like Amazon CloudFront?

Their core function is to loadbalance and serve static files with the highest performance possibly across different geographic locations.

If that's not an option for you, +1 for either Nginx or Lighttpd plus HAProxy.

share|improve this answer
Ok so what I would do is add another layer of HAProxy for load balancing where it asks webserver (nginx, apache .. etc) to serve static content, and other the servers for dynamic content, but where I would add the rewrite rules then? does HAProxy has url rewriting capabilities? – wael34218 Jan 8 '11 at 8:42
HAProxy can redirect based on URL matches, so i.e. a ".php" URL could get sent to a different server than a ".gif" server. Although the general practice I use would be to have rather than use loadbalancer rewrites. – Rafiq Maniar Jan 8 '11 at 16:53

Nginx is a pretty much exellent in static content and fair as a load balancer.

share|improve this answer

For static content, most popular web servers are great. Nginx, Apache (mpm, not forking), lighttpd, and friends. As long as they're c10k friendly, they'll be fine.

I'm going to disagree on using these for load balancing. As a load balancer, these tend to be mediocre at best. Take a look at software dedicated to load balancing like HAProxy or even Squid, which have more balancing algorithms, features to allow for pinning connections to backend servers, Layer 7 routing features, and which report statistics relevant to load balancing for monitoring and trending.

share|improve this answer
Are HAProxy and Squid capabale of doing url rewriting? Right now I am using apache to serving static content + load balancing(to other servers that provide dynamic content), it also rewrite urls if client is using old urls (no longer in use) – wael34218 Jan 8 '11 at 8:46
HAProxy does, and I believe Squid can as well. – blueben Jan 8 '11 at 18:59

If you don't want to use Apache, Nginx or Cherokee. Cherokee is relatively new but looks promising, and Nginx is proven.

share|improve this answer

I know your question specifically pertains to load balancing web servers, but I can't help but mention Squid for load balancing. I assume that you have multiple servers since you discuss load balancing, so I would highly advise you look into dedicating a box to Squid. It even has a neat round robin function to load balance evenly across your servers. Placing a group of servers running something like nginx behind a squid box would be a pretty powerful solution...

share|improve this answer
Squid in front of backend webservers is a good suggestion but it's worth pointing out that the value of Squid here isn't in its load balancing features but in its caching reverse proxy features. In essence, the Squid box will cache the most highly requested content in memory and effectively reduces the load on the backend servers. Check out Varnish for this purpose too, it performs better than Squid in many scenarios. – Rafiq Maniar Jan 7 '11 at 5:47

If you are familiar with one of these I would count that on the plus side.

I can't judge your's but there are more places where things go ugly because of missing knowledge than suboptimal choice of static file server.

share|improve this answer

Your Answer


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.