1. Home
  2. Basics
  3. Which Server Configurations to choose?

Which Server Configurations to choose?

We at SetupServer.io provides various server configurations, but all the configurations have its own pros and cons. We have provided all of them here so that you can choose the best server configurations for your servers.

Server performance is based on mainly Apache and Nginx models and how they are used. Some of our configurations are mentioned below:

LAMP

LAMP Stack or LAMP is an acronym for Web Service Model comprising of – Linux, Apache, MySQL database and PHP programming language.

Apache creates processes and threads to handle additional connections. The administrator can configure the server to control the maximum number of allowable processes. This configuration varies depending on the available memory on the machine. Too many processes exhaust memory and can cause the machine to swap memory to disk, severely degrading performance. Plus, when the limit of processes is reached, Apache refuses additional connections. This is the major drawback for Apache web server.

Besides this, Apache contains tons of features compared to Nginx Server. Apache uses .htaccess file for URL rewrite and can have better performance while serving dynamic contents.

If your site contains more dynamic than static content and less traffic over internet, better go with Apache Architecture as it is more reliable.

LEMP

LEMP Stack or LEMP is an acronym for Web Service Model comprising of – Linux, Nginx, MySQL database and PHP programming language.

Nginx is better for handling static content rather than dynamic one.

Nginx does not create new processes for each web request, instead the administrator configures how many worker processes to create for the main Nginx process. (One rule of thumb is to have one worker process for each CPU.) Each of these processes is single-threaded. Each worker can handle thousands of concurrent connections. It does this asynchronously with one thread, rather than using multi-threaded programming.

Apart from this, it lacks in comparison with number of features that are present in Apache architecture. Nginx performance degrades when it comes with serving dynamic contents. Above that it doesn’t support .htaccess

If your site contains more static than dynamic content and have more traffic over internet, better go with Nginx Architecture to provide better scalability and performance.

LAMP with Nginx as a Reverse Proxy

The best way to overcome disadvantages of both Apache and Nginx, you can use this configuration. It uses traditional LAMP architure as base and uses Nginx as a reverse proxy.

Apache is known for its power and Nginx for speed. This means Nginx can serve up static content quicker, but Apache includes the modules needed to work with back end application servers and run scripting languages.

The conventional configuration for this partnership is to place Nginx in front of Apache as a reverse proxy. This will allow Nginx to to handle all requests from clients. This takes advantage of Nginx’s fast processing speed and ability to handle large numbers of connections concurrently.

For static content, which Nginx excels at, the files will be served quickly and directly to the client. For dynamic content, for instance PHP files, Nginx will proxy the request to Apache, which can then process the results and return the rendered page. Nginx can then pass the content back to the client.

This setup works well for many people because it allows Nginx to function as a sorting machine. It will handle all requests it can and pass on the ones that it has no native ability to serve. By cutting down on the requests the Apache server is asked to handle, we can alleviate some of the blocking that occurs when an Apache process or thread is occupied.

This configuration also allows you to scale out by adding additional backend servers as necessary. Nginx can be configured to pass to a pool of servers easily, increasing this configuration’s resilience to failure and performance.

Updated on July 15, 2017

Was this article helpful?

Related Articles