Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I've traditionally deployed my sites under apache, simply by default. I've heard things about NGinX though and I'm wondering under which conditions it would be superior. In addition to apache and Nginx, what the other options are for webservers and what are their benefits?

share|improve this question
3  
Very broad question. In order to answer the "worth" question, I think you need to give a bit more explanation of your context. –  jessegavin Jul 8 '10 at 21:15
add comment

5 Answers

up vote 6 down vote accepted

Yes.

One of the web servers used to have a large spike in load every few hours. After looking into the logs, I found out when the load spike happened, there where a lot of people looking at the gallery.

So I off-loaded 99% of the static content from apache to nginx. apache was left to serve all of the php. The load on my web servers dropped to a nice low number and with no more high load spikes.

If you are looking to get more out of your servers, definitely have some light-weight server serve all the static content.

share|improve this answer
    
Why on earth would the load be any different? –  delete Jul 9 '10 at 0:22
    
+1, I also did this a while back, worked excellently. –  theotherreceive Jul 9 '10 at 0:24
3  
@Kinopkio nginx doesn't require a process/thread per connection, so it can serve the same number of clients using less resources than apache. –  theotherreceive Jul 9 '10 at 0:25
    
Ah ok sorry I was thinking in terms of bandwidth rather than server load. –  delete Jul 9 '10 at 0:42
add comment

Apache can be a bit heavy, and can fall over when under heavy load. There are lighter weight servers available, including nginx, lighttpd, and cherokee.

These lightweight options can be set up to serve static files quickly, and delegate dynamic server-side work to Apache.

share|improve this answer
add comment

There are a PILE of webservers out there. I expect depends on the usage you want. Apache will do most of what people want, it's known good, well updated, and will run on nearly any hardware and operating system combination.

For a comparison of web servers, check Comparison of web server software.

share|improve this answer
add comment

Netcraft tracks market share of web servers & according to them, IIS stands second after Apache with a 26.03% share (as of July 2010). This is based on a survey of 205+ million sites

This link has reasons why you should check out IIS7 if you use Apache today

share|improve this answer
    
The problem with IIS7 on Linux is .... it don't run run run .. it don't run run ... –  Tim Post Jul 19 '10 at 6:13
    
As per my understanding of the question, there is nothing that says OP requires web server for a particular OS...or am I missing something? I assumed he may opt for Windows as well. –  mvark Jul 19 '10 at 10:54
add comment

It really depends on what you're doing.

If you only have static content, you don't need Apache. nginx or lighttpd would serve you just fine.

If you have a mix of static and dynamic (well, Perl or PHP), but a small site, you can still get by with one of those alternative plus FastCGI, or just throw the whole thing into Apache.

If you're serving Ruby along with your static content, mod_passenger in Apache should serve you well, with nginx/lighttpd/etc serving your static content.

For Python (my area of expertise), you can have Apache use mod_python if you want but prepare for slowness. mod_wsgi is better but you still have the overhead of Apache, which is fine if you have a lot of heavy dynamic traffic. Apache is a heavy lifter most of the time.

If you don't have a ton of heavy traffic, look into new systems like gunicorn or uWSGI or the all-in-one server Cherokee to handle your Python. Cherokee handles static files, too. The rest, you'll still want to use nginx/lighttpd to serve the static content.

Java and other languages, I have no idea about.

The great thing about using nginx, though, is that it's amazingly configurable. So set up a couple of static servers with different subdomains, one each for CSS, images, and JS. That way you help avoid the limit of 2 files per domain at a time. Set up several servers and then set up an nginx proxy/load-balancer in front of them to make sure all of your static content is always available.

Basicaly, YES, look at more than just Apache!

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.