The Best Linux Web Server Software (& Apache Alternatives)

webservers title   The Best Linux Web Server Software (& Apache Alternatives)Since the protocol that runs the world wide web – the HTTP protocol – is open and viewable to the entire world, anyone with the programming knowledge is able to write their own web server. In fact Wikipedia lists over 60 web servers and those are only the ones released to the public. So which is the best one that you should run on your Linux server?

To be able to determine the ‘best’ one we need to look at several factors. Ultimately it depends on what your end goal is since some web servers are geared towards a kind of client, others for speed and others for security. The main factors we are going to look at are reliability, speed, security and ease of use.


A lot of web servers will make claims to being the “king” of one or more of these factors. However I believe the proof is in the pudding and if you look at actual web server usage across the internet you get a better idea of the wisdom of the crowds. Netcraft has been keeping track of web server types, hostnames and other data since 1995 and is a great way to see what the current trends are in web server usage.

Here is their web server usage survey up until December 2010:

netcraft survey   The Best Linux Web Server Software (& Apache Alternatives)

Of the top web servers in current use, Microsoft’s web server IIS is the only pure-Windows one. Apache by and large is the most widely used web server software based on the number of users. It is also good to note that it is cross-platform and will run on both Windows and Linux systems.

Rounding out the top of the list we have Other (all other web server software), Google (who uses their own private custom server software), nginx and lighttpd. The three I will detail as the best Linux web server software are lighttpd, nginx and Apache.

lighttpd

light logo e1293635122436   The Best Linux Web Server Software (& Apache Alternatives)Lighttpd (pronounced “Lighty”) was born out of a desire to create a fast, secure and reliable web server with a small memory footprint. From a functional standpoint it works much the same as Apache, the most widely used web server, but with less memory used on busy servers and also greater throughput when pushed to its limit. It currently powers several extremely high traffic websites such as Wikipedia and YouTube.

Configuration is done very similar to Apache (which most people are used to) however the syntax is very different. Their documentation is very thorough and will guide you though any setup tasks you need. There are also many how-tos available online which can help you through the setup of the server depending on your OS or you can check Google for specific details.

Lighttpd is a good web server for those looking to set up a machine with not a lot of memory available or who hope to scale their traffic easier using higher powered software.

nginx

nginx   The Best Linux Web Server Software (& Apache Alternatives)Nginx is bit of a different beast. While it does work as normal it is mainly utilized across higher trafficked websites as a web proxy; in other words when a user visits the nginx server with their browser it will send the request to other servers on its own private network depending on the type of content requested.

The documentation available is not clear for beginners, but once you get to know the ins and outs of nginx you will see how powerful it is especially when running larger sites. The best how-tos are available over at Howtoforge and you may need to do some Googling to find specific instructions for your situation.

Apache HTTP Server

logo apache 300x300 e1293635169232   The Best Linux Web Server Software (& Apache Alternatives)The Apache HTTP Server is by and large the most popular web server on the Internet running on almost 60% of all web servers and also the one we now compare all others to. Apache’s security, stability and flexibility is why most web server administrators choose it and Apache has proven itself over the long run.

Configuration is well documented and innumerable how-tos and walk-throughs are available for someone just getting started with it. If you are new to web servers Apache is definitely the place to begin.

Apache is available in the default packages on many Linux systems and is actually installed by default on most and ‘httpd’ is synonymous with the Apache web server. As with the other software above the Apache HTTP software is open source and anyone can contribute to it or modify it to their needs.

Which One Is Right For You?

The answer to this question totally depends on your usage. If you are just getting started I would recommend beginning with Apache. If you are looking for a challenge or want to get to know alternatives to Apache, check out lighttpd which uses a low memory footprint. Finally if you need a web proxy for a bank of servers – check out nginx which works very well in this situation.

Do you have any other favorite Linux web servers? Be sure to tell us below!

The comments were closed because the article is more than 180 days old.

If you have any questions related to what's mentioned in the article or need help with any computer issue, ask it on MakeUseOf Answers—We and our community will be more than happy to help.

14 Comments -

pceasies

nginx is extremely fast for static sites. You can test them out by making hundreds of connections using the Apache Benchmark Tool.

Aibek

Heard lots of good thing about nginx lately, planning to test it on MakeUseOf.com soon.

pceasies

I’m not sure how well it will do with PHP, but using it as a reverse proxy to serve all static content and pass the PHP to apache should have pretty good results. I’m going to set up a Ubuntu Server virtual machine and see how it does with WordPress.

Aibek

I heard that some of the popular WordPress powered sites found it better
than Apache. Will let you know once we have tried it.

Dave Drager

Can’t wait to see how it works out (and let me know if you need any help!)

pceasies

** I don’t have a lot of Linux experience, so configuration is by no means optimizedTest Platform:Ubuntu 10.04 in VirtualBox2GB RAM8GB Dynamically Expanding HD (hosted on a separate physical HD as host OS)4x cores – Intel i7 920 @ 2.67GHz (This is basically half the CPU. VirtualBox used around 40-50% CPU when the virtual machine showed 100% on each core (measured with htop))Apache/2.2.14MySQL version 5.1.41-3ubuntu12.6PHP version 5.3.5-0.dotdeb.0XCache v1.3.0nginx/0.7.65memcache v3.0.4100Mbps ethernet shared with host, mode bridgedThe first tests with Apache2 and mod_php5 showed around 10 reqs/sec with concurrency of 100 and a total of 500 requests. With caching enabled (XCache) it jumped up to around 40reqs/sec. With memcached it was around 80reqs/sec, the highest.In both tests when W3TotalCache was set to memcache for all options the performance was significantly higher. I had some problems with eaccelerator so didn’t test it (the stable doesn’t support PHP 5.3). When I used APC with Apache2 it filled up the memory almost instantly and I had to stop the benchmark and give it about 10-15mins to recover.The XCache results were better than default, with no cache, but less than memcached.nginx had the overall best performance configured with memcached and php-fpm and was able to beat apache2 easily. nginx also had less RAM usage and a little bit less CPU (90-95% instead of consistent 100%)I’m not sure how hard it is to get nginx to work with WordPress pretty URLs since it doesn’t work the same as mod_rewrite. I did some Googling, but a few basic samples didn’t work. The blog was installed in {Local_IP}/wordpress

Dave Drager

Thanks for the results. This sounds about like what I’ve heard the results are.

Also found some sample WordPress/nginx rewrite scripts but haven’t tested them at all. I’m sure it should be doable with some tweaking!

B Sdf

Wonderful.

Share a website with you ,

put this url in google sirch

( .aamall.us )

Believe you will love it.

We accept any form of payment

Aibek

Heard lots of good thing about nginx lately, planning to test it on MakeUseOf.com soon.

Aibek

I heard that some of the popular WordPress powered sites found it better
than Apache. Will let you know once we have tried it.

pceasies

** I don’t have a lot of Linux experience, so configuration is by no means optimized

Test Platform:
Ubuntu 10.04 in VirtualBox
2GB RAM
8GB Dynamically Expanding HD (hosted on a separate physical HD as host OS)
4x cores – Intel i7 920 @ 2.67GHz (This is basically half the CPU. VirtualBox used around 40-50% CPU when the virtual machine showed 100% on each core (measured with htop))
Apache/2.2.14
MySQL version 5.1.41-3ubuntu12.6
PHP version 5.3.5-0.dotdeb.0
XCache v1.3.0
nginx/0.7.65
memcache v3.0.4
100Mbps ethernet shared with host, mode bridged

The first tests with Apache2 and mod_php5 showed around 10 reqs/sec with concurrency of 100 and a total of 500 requests. With caching enabled (XCache) it jumped up to around 40reqs/sec. With memcached it was around 80reqs/sec, the highest.

In both tests when W3TotalCache was set to memcache for all options the performance was significantly higher. I had some problems with eaccelerator so didn’t test it (the stable doesn’t support PHP 5.3). When I used APC with Apache2 it filled up the memory almost instantly and I had to stop the benchmark and give it about 10-15mins to recover.

The XCache results were better than default, with no cache, but less than memcached.

nginx had the overall best performance configured with memcached and php-fpm and was able to beat apache2 easily. nginx also had less RAM usage and a little bit less CPU (90-95% instead of consistent 100%)

I’m not sure how hard it is to get nginx to work with WordPress pretty URLs since it doesn’t work the same as mod_rewrite. I did some Googling, but a few basic samples didn’t work. The blog was installed in {Local_IP}/wordpress

Dave Drager

Thanks for the results. This sounds about like what I’ve heard the results are.

Also found some sample WordPress/nginx rewrite scripts but haven’t tested them at all. I’m sure it should be doable with some tweaking!

Leszek Cyfer

I wonder what “other” serwer software peaked tremendously at the beginning of 2009 to disappear without a trace after a year. Looks really strange – the jump and the return was almost digital in nature…

Dave Drager

I found this curious too; If I recall I read that some large platform, blogger or wordpress or something, switched for a while then switched back.