User Tools

Site Tools


nginx

Nginx

Return to Nginx installation, Nginx on WSL

Snippet from Wikipedia: Nginx

Nginx (pronounced "engine x" EN-jin-EKS, stylized as NGINX or nginx) is a web server that can also be used as a reverse proxy, load balancer, mail proxy and HTTP cache. The software was created by Russian developer Igor Sysoev and publicly released in 2004. Nginx is free and open-source software, released under the terms of the 2-clause BSD license. A large fraction of web servers use Nginx, often as a load balancer.

A company of the same name was founded in 2011 to provide support and NGINX Plus paid software. In March 2019, the company was acquired by F5, Inc. for $670 million.

  • Definition: nginx is an open-source web server, reverse proxy server, and load balancer. It is known for its high performance, stability, rich feature set, simple configuration, and low resource consumption.
  • Function: Serves static content, acts as a reverse proxy for HTTP and HTTPS, performs load balancing, and can also be used as an IMAP/POP3 proxy server.
  • Components:
     * '''HTTP Server''': Handles web traffic, serves static files, and interfaces with application servers.
     * '''Reverse Proxy''': Forwards client requests to backend servers, providing load balancing and caching.
     * '''Load Balancer''': Distributes traffic across multiple servers to ensure optimal resource usage and reliability.
     * '''Mail Proxy''': Supports IMAP, POP3, and SMTP protocols.
     * '''Streaming Server''': Capable of handling streaming media.
  • Features:
     * '''High Performance''': Efficient handling of multiple connections with low memory usage.
     * '''Reverse Proxying''': Supports load balancing, caching, and SSL termination.
     * '''Load Balancing''': Offers multiple algorithms, such as round-robin and least connections.
     * '''Static and Dynamic Content''': Serves static files and forwards requests to dynamic content handlers.
     * '''Security''': Provides features like SSL/TLS support, access control, and web application firewall integration.
  • Usage: Widely used for serving web content, acting as a reverse proxy and load balancer in high-traffic environments, and providing secure and efficient delivery of web services.

Examples

  • Basic nginx configuration:
     ```nginx
     server {
         listen 80;
         server_name example.com;

     location / {
         root /usr/share/nginx/html;
         index index.html index.htm;
     }
     location /api/ {
         proxy_pass http://backend_server;
     }
 }
 ```

  • Setting up a reverse proxy:
     ```nginx
     server {
         listen 80;
         server_name example.com;

     location / {
         proxy_pass http://backend_server;
         proxy_set_header Host $host;
         proxy_set_header X-Real-IP $remote_addr;
         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
         proxy_set_header X-Forwarded-Proto $scheme;
     }
 }
 ```

  • Using nginx in a Python script:
     ```python
     import subprocess

 def start_nginx():
     result = subprocess.run(['nginx', '-s', 'start'], capture_output=True, text=True)
     if result.returncode == 0:
         print("nginx started successfully")
     else:
         print(f"Failed to start nginx: {result.stderr}")
 def stop_nginx():
     result = subprocess.run(['nginx', '-s', 'stop'], capture_output=True, text=True)
     if result.returncode == 0:
         print("nginx stopped successfully")
     else:
         print(f"Failed to stop nginx: {result.stderr}")
 # Start nginx
 start_nginx()
 # Stop nginx
 stop_nginx()
 ```

  • Using nginx in a Java program:
     ```java
     import java.io.BufferedReader;
     import java.io.InputStreamReader;

 public class NginxExample {
     public static void startNginx() {
         executeNginxCommand("start");
     }
     public static void stopNginx() {
         executeNginxCommand("stop");
     }
     private static void executeNginxCommand(String command) {
         try {
             Process process = new ProcessBuilder("nginx", "-s", command).start();
             BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
             String line;
             while ((line = reader.readLine()) != null) {
                 System.out.println(line);
             }
             reader.close();
             int exitCode = process.waitFor();
             if (exitCode != 0) {
                 BufferedReader errorReader = new BufferedReader(new InputStreamReader(process.getErrorStream()));
                 while ((line = errorReader.readLine()) != null) {
                     System.err.println("Error: " + line);
                 }
                 errorReader.close();
             }
         } catch (Exception e) {
             e.printStackTrace();
         }
     }
     public static void main(String[] args) {
         // Start nginx
         startNginx();
         // Stop nginx
         stopNginx();
     }
 }
 ```

Summary

  • nginx: A powerful, open-source web server, reverse proxy, and load balancer known for its high performance and low resource consumption. It supports serving static content, reverse proxying, load balancing, and secure HTTP/S traffic handling. nginx is widely used in web hosting and high-traffic environments due to its efficiency and reliability.

Short Description: Open source web server and a reverse proxy server

}}

Nginx (pronounced “engine x”<ref name=“Sysoev” />

) is a web server that can also be used as a reverse proxy, load balancer, mail proxy and HTTP cache. The software was created by Igor Sysoev and publicly released in 2004.<ref name=“Mobily” /> Nginx is free and open-source software, released under the terms of the 2-clause BSD license. A large fraction of web servers use Nginx,<ref name=“netcraft2017” /> often as a load balancer.<ref name=“Linode” />

A company of the same name was founded in 2011 to provide support and Nginx Plus paid software.<ref name=“D” /> In March 2019, the company was acquired by F5, Inc. for $670&nbsp;million.<ref name=“techcrunch-f5acquires”/>

Popularity

W3Tech's web server count of all web sites ranked Nginx first with 33.6%. Apache was second at 31.4% and Cloudflare Server third at 21.6%.<ref name=“w3tech2022-06”/>

, Netcraft estimated that Nginx served 22.01% of the million busiest websites with Apache a little ahead at 23.04%. Cloudflare at 19.53% and Microsoft Internet Information Services at 5.78% rounded out the top four servers for the busiest websites. Some of Netcraft's other statistics show Nginx ahead of Apache.<ref name=“netcraft2022-03”/>

A 2018 survey of Docker usage found that Nginx was the most commonly deployed technology in Docker containers.<ref name=“docker” /> In OpenBSD version 5.2 (November 2012), Nginx became part of the OpenBSD base system, providing an alternative to the system's fork of Apache 1.3, which it was intended to replace,<ref name=“openbsd_5.2” /> but later in version 5.6 (November 2014) it was removed in favor of OpenBSD's own httpd(8).<ref name=“Nginx Removed” />

Features

Nginx is easy to configure in order to serve static web content or to act as a proxy server.<ref name=“Beginner” />

Nginx can be deployed to also serve dynamic content on the network using FastCGI, SCGI handlers for scripts, WSGI application servers or Phusion Passenger modules, and it can serve as a software load balancer.<ref name=“Kleinman” /> <ref name=“Beginner” />

Nginx uses an asynchronous event-driven approach, rather than threads, to handle requests.<ref name=“Welcome” /> Nginx's modular event-driven architecture can provide predictable performance under high loads.<ref name=“aosabook” /><ref name=“Configuration” />

HTTP proxy and Web server features

Mail proxy features

  • TLS/SSL support
  • STARTTLS support
  • SMTP,<ref name=“auto”>

    </ref> POP3, and IMAP proxy

  • Requires authentication using an external HTTP server or by an authentication script<ref name=“Authentication” /><ref name=“auto” />

Other features include upgrading executable and configuration without client connections loss,<ref name=“Controlling nginx” /> and a module-based architecture with both core<ref name=“documentation” /> and third-party module support.<ref name=“3rdPartyModules” />

The paid Plus product includes additional features such as advanced load balancing and access to an expanded suite of metrics for performance monitoring.<ref name=“Plus metrics” /><ref name=“Plus load balancing” />

Nginx vs Nginx Plus

There are two versions of Nginx: Nginx Open Source and Nginx Plus.

Nginx Open Source is free and open-source software.

Nginx Plus is sold as a subscription model. It offers features in addition to Nginx Open Source, such as active health checks, session persistence based on cookies, DNS-service-discovery integration, Cache Purging API, AppDynamic, Datalog, Dynatrace New Relic plug-ins, Active-Active HA with config sync, Key-Value Store, on-the-fly with zero downtime updates upstream configurations, and key‑value stores using Nginx Plus API<ref name=“Load balancing2” /> and web application firewall (WAF) dynamic module.<ref name=“about” />

Nginx in comparison to Apache

Nginx was written with an explicit goal of outperforming the Apache web server.<ref name=“our view” /> Out of the box, serving static files, Nginx uses much less memory than Apache, and can handle roughly four times as many requests per second.<ref name=“dreamhost” /> However, this performance boost comes at a cost of decreased flexibility, such as the ability to override systemwide access settings on a per-file basis (Apache accomplishes this with an .htaccess file, while Nginx has no such feature built in).<ref>

</ref><ref>

</ref>

Formerly, adding third-party modules to Nginx required recompiling the application from source with the modules statically linked. This was partially overcome in version 1.9.11 in February 2016, with the addition of dynamic module loading.<ref name=“changelog” /> However, the modules still must be compiled at the same time as Nginx, and not all modules are compatible with this system; some require the older static linking process.<ref name=“dynamic modules” />

Nginx is generally considered to be less stable on Windows Server than it is on Linux, while Apache has equal support for both.

Nginx Unit

Nginx Unit is an open-source web application server, released in 2017 by NGINX, Inc. to target multi-language microservices-based applications. The initial release supported applications written in Go, PHP, and Python.<ref name=Lardinois2017>

</ref> By version 1.11.0, the support was extended to Java, Node.js, Perl, and Ruby applications; other features include dynamic configuration, request routing, and load balancing.<ref name=Nginx2020>

</ref><ref name=NetCraft2020>

</ref>

History

}}

Igor Sysoev began development of Nginx in 2002.<ref name=“Mobily” /> Originally, Nginx was developed to solve the C10k problem, and to fill the needs of multiple websites including the Rambler search engine and portal, for which it was serving 500 million requests per day by September 2008.<ref name=“linuxjournal” />

Nginx Inc. was founded in July 2011 by Sysoev and Maxim Konovalov<ref name=“D” /><ref>

</ref> to provide commercial products and support for the software.<ref name=“Company” />

The company's principal place of business is San Francisco, California, while legally incorporated in British Virgin Islands.<ref name=“D” />

In October 2011, Nginx, Inc. raised $3&nbsp;million from BV Capital, Runa Capital, and MSD Capital, Michael Dell's venture fund.<ref name=“nginx-a-tech” />

The company announced commercial support options for companies using Nginx in production. Nginx offered commercial support in February 2012,<ref name=“commercial support” /><ref name=“Vaughan-Nichols” /> and paid Nginx Plus subscription in August 2013.<ref name=“Plus” />Support packages focus on installation, configuration, performance improvement, etc.<ref name=“Taft” /> Support includes proactive notifications about major changes, security patches, updates and patches. Nginx, Inc. also offers consulting services to assist customers in custom configuration or adding additional features.<ref name=“ZDNet-08-02-12” />

In October 2013, Nginx, Inc. raised a $10&nbsp;million series B investment round led by New Enterprise Associates.<ref name=“Kerner” /> That round included previous investors, as well as Aaron Levie, CEO and founder of Box.com.<ref name=“nginx2” /><ref name=“O” /> In December 2014, Nginx raised a $20&nbsp;million series B1 round led by New Enterprise Associates, with participation from e.ventures (formerly BV Capital), Runa Capital, Index Ventures and Nginx's own CEO Gus Robertson.<ref name=“nginx3-tech” /><ref name=“nginx3-vb” />

In September 2017, Nginx announced an API management tool, NGINX Controller, which would build off of their API Gateway, NGINX Plus.<ref>

</ref><ref>

</ref> In October 2017, Nginx, Inc. announced general available Nginx Amplify SaaS providing monitoring and analytics capabilities for Nginx.<ref name=“amplify” />

In June 2018, Nginx, Inc. raised $43&nbsp;million in Series C Funding in a round led by Goldman Sachs “to Accelerate Application Modernization and Digital Transformation for Enterprises”.<ref>

</ref>

On 11 March 2019, F5 Networks acquired Nginx, Inc. for US$670 million.<ref>

</ref>

On 12 December 2019, it was reported that the Moscow offices of Nginx Inc. had been raided by police, and that Sysoev and Konovalov had been detained. The raid was conducted under a search warrant connected to a copyright claim over Nginx by Rambler—which asserts that it owns all rights to the code because it was written while Sysoev was an employee of the company.<ref>

</ref> On 16 December 2019, Russian state lender Sberbank, which owns 46.5 percent of Rambler, called an extraordinary meeting of Rambler's board of directors asking Rambler's management team to request Russian law enforcement agencies cease pursuit of the criminal case, and begin talks with Nginx and with F5.<ref>

</ref>

On 18 January 2022, it was announced that Igor Sysoev is leaving Nginx and F5.<ref>

</ref>

See also

References

</ref> <ref name=“Ohloh”>

</ref> <ref name=“Windows”>

</ref> <ref name=“platforms”>

</ref> <ref name=“LICENSE”>

</ref> <ref name=“Sysoev”>

</ref> <ref name=“Mobily”>

</ref> <ref name=“D”>

</ref> <ref name=“netcraft2017”>

</ref> <ref name=“Linode”>

</ref> <ref name=“docker”>

</ref> <ref name=“openbsd_5.2”>

</ref> <ref name=“Nginx Removed”>

</ref> <ref name=“mdoc-intro”>

</ref> <ref name=“mdoc”>

</ref> <ref name=“Kleinman”>

</ref> <ref name=“Welcome”>

</ref> <ref name=“aosabook”>

</ref> <ref name=“Configuration”>

</ref> <ref name=“Beginner”>

</ref> <ref name=“Load balancing”>

</ref> <ref name=“101 Switching Protocols”>

</ref> <ref name=“Authentication”>

</ref> <ref name=“Controlling nginx”>

</ref> <ref name=“documentation”>

</ref> <ref name=“3rdPartyModules”>

</ref> <ref name=“Plus load balancing”>

</ref> <ref name=“Plus metrics”>

</ref> <ref name=“Load balancing2”>

</ref> <ref name=“about”>

</ref> <ref name=“our view”>

</ref> <ref name=“dreamhost”>

</ref> <ref name=“changelog”>

</ref> <ref name=“dynamic modules”>

</ref> <ref name=“linuxjournal”>

</ref> <ref name=“Company”>

</ref> <ref name=“nginx-a-tech”>

</ref> <ref name=“commercial support”>

</ref> <ref name=“Vaughan-Nichols”>

</ref> <ref name=“Plus”>

</ref> <ref name=“Taft”>

</ref> <ref name=“ZDNet-08-02-12”>

</ref> <ref name=“Kerner”>

</ref> <ref name=“nginx2”>

</ref> <ref name=“O”>

</ref> <ref name=“nginx3-tech”>

</ref> <ref name=“nginx3-vb”>

</ref> <ref name=“amplify”>

</ref> <ref name=“techcrunch-f5acquires”>

</ref> <ref name=“w3tech2022-06”>

</ref> <ref name=“netcraft2022-03”>

</ref>

Fair Use Sources

nginx.txt · Last modified: 2024/08/12 05:26 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki