- Bare Metal
- Bare Metal Cloud
- Big Data Benchmarks
- Big Data Experts Interviews
- Big Data Technologies
- Big Data Use Cases
- Big Data Week
- Data Lake as a Service
- Dedicated Servers
- Disaster Recovery
- Industry Standards
- Online Retail
- People of Bigstep
- Performance for Big Data Apps
- Press Corner
- Tech Trends
- What is Big Data
Top Linux Web Servers: Pros and Cons
For a long time, Apache was the only option as a Linux web server and held almost a monopoly in the open-source market. Today, things have changed, and several open source web servers are available. Which one is best? We’ll try to answer the question in this blog post.
Apache is still the most widely use web server in the world, due to several reasons. It was released back in 1995 and it is available by default in most Linux distributions.
- Easy to configure
- Supports perdirectory settings using .htaccess files, which makes it ideal for shared hosting
- Widely available documentation and tutorials
- Has a dynamic module system that can be used to add new features
- Offers a choice between several MultiProcessing Modules (MPMs) that handle connections
- Not as fast as some of the newer alternatives
- Can’t handle a large number of simultaneous requests
- Updates are not very frequent and new technologies are integrated slowly
Nginx was designed from the start as a solution to the limitations of the Apache web server, especially for its inability to handle thousands of concurrent connections.
- High performance, in particular when serving static files
- Built on an asynchronous architecture in order to handle high loads
- Low memory usage
- Supports many useful features such as load balancing, static and dynamic caching, reverse proxy setups or WebSockets
- When used with PHP-FPM, it is the best option for Wordpress websites
- Not suitable for shared hosting on its own, since there is no .htaccess-like feature
- Modules are normally enabled during build time, and recompilation is needed in order to change them
Unlike its competitors, Lighthttpd was developed for a specific purpose, as a web server for systems with limited resources.
- Very low CPU and RAM requirements
- Handles requests asynchronously, similar to Nginx
- Only uses a single CPU thread, so performance is limited
- Lacks many advanced features
- Suitable for small websites only
LiteSpeed comes in two versions: a free one known as OpenLiteSpeed and a paid enterprise version with extended functionality.
- Very high performance due to its event-driven architecture
- The enterprise version is fully compatible with Apache configuration files (including .htaccess and rewrite rules), so it can instantly replace it as a much faster web server for shared hosting
- Comes with its own very effective php handler (lsapi)
- Can be administered from a GUI interface
- Advanced caching options, the paid version has modules tweaked for the most popular CMS and ecommerce platforms
- Expensive license
- The free version is limited and poorly documented
Caddy is a newest entry on the list and was designed from the start to be as simple to configure as possible, while offering strong security features.
- Very easy to install and configure with the default settings
- The binary doesn’t need any dependencies or libraries, which makes it perfect for containers
- HTTPS is enabled by default and certificates are renewed automatically
- Can be controlled through an API
- Supports load balancing, proxying, and WebSockets
- Unsuitable for complex projects that require other settings than its defaults
Now that we know their advantages and disadvantages, which web server is the best? The answer depends on your use case. Nginx is a very fast and powerful option, Apache is a great general-purpose web server, while LiteSpeed represents a premium alternative. Caddy works great if you need simplicity, while Lighthttpd works best when resources are low.
In an extended infrastructure, you can combine the strengths of various web servers in order to create an effective setup. For example, Nginx can be the load balancer and serve static files, while Apache runs in the back-end on multiple servers, with per-directory settings.
Which web server do you use and why? Which features are more important for your use case? Let’s discuss. For any questions on servers and infrastructure, contact us anytime.
About the Author
Dragos Baldescu is a Level 2 Technical Support Engineer at Bigstep, passionate about Linux and testing out new technologies and solutions.