5

Any of these web server software i.e., Apache, Nginx and Cherokee is suitable for my website at the moment. And I am learning sysadmin to be able to manage my server (and not for a job).

For a beginner that I am, any web server is equally new. So, please take a look at my requirements and kindly suggest a web server software to start with (and sit on... like forever):

  • Scalability
  • low resource footprint
  • support for PHP, MySQL, APC, Memcached, Meteor - - all for a wordpress website
  • useful now and in the long-term as my website's traffic increases
  • load tolerant
  • everything else...

As you can see, I am still in the beginner's phase. So, please don't come saying this is a controversial question. It definitely abides by SF's rules (or hopefully so, I just read them).

0

5 Answers 5

11

Apache sure is your safest starting point. Not that it's necessarily easier than the others, but the software you want to run on top of it has been tested with Apache with 100% certainty. Usually everything works with other web servers too, but unless you already have experience about typical gotchas, Apache is the way to go for you.

Performance-wise Apache is fine. nginx, lighttpd and other more performant web servers starts to matter only in corner-cases like YouTube. For your typical web sites (where with a decent server & network bandwidth 'typical' can easily be tens of millions of page loads per month) Apache won't be the bottleneck; it can handle thousands and thousands of static http requests per second without sweat, and with dynamic applications your PHP script / database / whatever is the actual bottleneck, anyway.

If Apache starts to be your bottleneck, you most likely need to scale out with more hardware. Though one scenario where nginx & lighttpd truly shines is serving out lots of large static content, such as video files.

16
  • I am looking at a 50 million pageview (per month) bearing website. Is Apache still fine?
    – user88753
    Aug 10, 2011 at 9:13
  • 7
    50M page view/month is 19 per second - apache will barely notice this.
    – user9517
    Aug 10, 2011 at 9:19
  • 5
    @Aahan: 30 pageviews per second is like background noise to whatever webserver you choose. Your server will barely notice that and with any decent server hardware the load average should hover near zero. Aug 10, 2011 at 9:55
  • 2
    There's actually a huge increase in server performance going from Apache to Nginx when mod_php is involved. Apache does not distinguish between processes with and PHP embedded so a simple image request can keep PHP busy (although usually for a short time) Nginx avoids this issue by separating the two out. I'd highly recommend getting a spoon feeding layer for Apache at the very least. Aug 10, 2011 at 14:21
  • 1
    @Martin F: Yes, this kind of things start to matter with serious traffic. One common way even with apache is to separate the static content to its own subdomain, such as images.yourdomain.com or static.yourdomain.com and have another server / Apache instance responding there, and having another server or more for dynamic content in www.yourdomain.com or yourdomain.com. Certainly there are dozens of other ways to accomplish this. Aug 10, 2011 at 14:30
4

I think Apache is the one with most tutorials and people that can help. Plus the combination (L)AMP - Linux Apache Mysql PHP works right from the start and is very easy to set up. Memcached also works fine with Apache and your mySQL database, if your site needs to scale to an intermediate size. I started with a simple LAMP setup and later installed Memcached when the traffic increased to several sites. With the help of some tutorials, everything was quite straightforward.

5
  • But I also heard Apache isn't very load tolerant, and aside from that it is also high on resources, isn't it?
    – user88753
    Aug 10, 2011 at 8:57
  • Compared to resource consumption caused by typical PHP stuff (WordPress, Drupal....) the Apache resource consumption is child's play. Aug 10, 2011 at 9:18
  • Memcached and MySQL have nothing to do with Apache.. You can use them with any web server, or without one. Aug 10, 2011 at 15:54
  • I fully agree with you, Memcached can be used with a variety of web servers and databases. But especially for beginners it is best if there are a lot of tutorials with the same setup... at least that helped me a lot.
    – Claude
    Aug 10, 2011 at 16:29
  • @Claude - But using Memcached is entirely based on the language. It never talks directly to the web server.. Aug 10, 2011 at 19:01
3

Apache is probably a safe bet for almost any "beginner's" scenario, mostly because of the vast expanse of documentation available for it.

NGINX is a great web server (among other things), but trying to integrate PHP and/or CGI with it requires some effort and hackery. It is very lightweight, and can do a lot of fancy stuff (like reverse-proxying), but it's probably not the best thing to bootstrap yourself on.

2

You're asking for the moon on a stick..

Apache a is very modular, easy to configure and updated web/application server. It is however not great for handling high volume traffic when doing application processing (like PHP), as it eats away enormous amounts of RAM for each children.

Nginx is a great webserver. It requires little to no resources (I've heard about production sites using 25MB ram and 2-3% CPU). It is however not an application server at all. It serves static content, or it proxies. Nothing else.

I've used both for a long, long time. Nginx+PHP-FPM is fun to set up and tweak, but often not necessary.

3
  • 1
    Just to clarify though, nginx does have native server-side includes, and supports FastCGI, so it is not purely proxy-or-nothing. It can also be set up to serve static content, pass anything it could not serve onto annother server, and replace any 404 or similar errors with a server-side redirection. Aug 10, 2011 at 20:22
  • @Kevin Cathcart: I think you misread my answer, I wrote "It serves static content, or it proxies. Nothing else." as in "does not parse any dynamic language"
    – pauska
    Aug 13, 2011 at 10:10
  • 2
    I was not misreading your answer, but I saw that it could be misread, so commented to clarify. Server side includes is not included in many people's defintions of static, depite not really being dynamic either. It would also be easy to misinterpert "or it proxies", as requiring a fully compliant HTTP 1.1 server to host the dynamic content, which is not the case, since it can also proxy to FastCGI services. Since those misreadings were possible, I thought clarifying them in a comment may be worthwhile. Aug 16, 2011 at 15:59
1

I've played with cherokee and apache2 both of them are nice and well documented. Cherokee does future a GUI webinterface to manage your server, which might be easier for some people. Especially beginners.

However most of the time when I need to get up a webserver quickly I resort to apache2, just because I'm used to setting it up.

When choosing between these three, you cannot go wrong with any one of them. All of them are good and have their pro's and con's, I suggest you take a look at some benchmarks like this one.

You must log in to answer this question.