Get the most out of your Centmin Mod LEMP stack
Become a Member

Nginx Using NGINX as a Web Server

Discussion in 'Nginx and PHP-FPM news & discussions' started by eva2000, May 25, 2014.

  1. eva2000

    eva2000 Administrator Staff Member

    May 24, 2014
    Brisbane, Australia
    Local Time:
    8:58 PM
    Nginx 1.25.x
    MariaDB 10.x
    NGINX has now passed Apache to become the most popular web server for the top 1,000 busiest websites and is closing in on becoming the most popular web server for the top 10,000 busiest web sites [web3tech]. Why is NGINX seeing such wide and increasing adoption and why should you consider using NGINX as your web server?

    Why NGINX

    NGINX is much more then just a web server. Historically, in the area of web application delivery, separate components have been used for the web server and the application delivery controller (ADC) or reverse proxy load balancer. Creating a scalable and high performance web server or ADC requires many of the same techniques. In many environments, part of the ADC’s role has been as a band-aid to help mitigate performance problems with the web server. By combining the ADC and web server into a single tool, NGINX is a really a new type of product for web application delivery, providing performance and scalability at both the ADC and web server layers. Another area where NGINX takes a different approach is in the delivery of dynamic content. NGINX can deliver static content locally, but for dynamic content, it acts as proxy in front of other servers that deliver the dynamic application content, thus keeping NGINX lean and allowing dynamic content generating to be done by servers that specialize in that, such as FastCGI or uWSGI based servers, application servers such as Websphere, JBoss, Tomcat, etc., or even Apache.

    When focusing on NGINX as a web server replacement for Apache, one of the major reasons that people move from Apache to NGINX is to get improved performance. Performance has many aspects, but one of the important areas where NGINX shines is in handling large numbers of concurrent connections.

    Dealing with many HTTP clients, each opening many connections, and with the latency and other delays involved, presents a challenge. The thread or process per connection model that Apache employs causes high overhead for each connection thus limiting the number of connections an Apache server can handle. NGINX uses a far more efficient model where a small number of processes can each handle a very large number of connections. This architecture allows a single server to handle a far larger number of clients. Here are the results of a test of NGINX and Apache and the number of requests per second they each were able to handle as a function of the number of concurrent connections:


    And from that same test, here is the memory usage as a function of the number of concurrent connections:


    So, this means that you can use a smaller number of NGINX servers to process the same load that would require a larger number of Apache servers, with all the benefits that come with that.

    Another reason users are using NGINX to replace Apache is move to the new way of delivering applications that NGINX makes possible, with the static content being served locally by NGINX and having NGINX proxy the dynamic content from other servers.

    As we said earlier, NGINX is more then just a high performance web server, it is loaded with features. Here are just some of the features available:

    • Support for multiple protocols: HTTP, HTTPS, SPDY, WebSocket, IMAP, POP3, SMTP
    • Caching
    • Compression
    • SSL Termination: TLSv1.1/TLSv1.2/SSL/SNI/PFS/PCI-DSS and OCSP Stapling
    • HTTP video streaming with MP4/FLV/HDS/HLS
    • Request filtering
    • Header manipulation
    • Activity monitoring
    • Live binary upgrades to eliminate downtime
    • Graceful restart with non-stop request processing
    • Logging

    The post Using NGINX as a Web Server appeared first on NGINX.

    Continue reading...
    Last edited: Jun 1, 2017