{"id":180027,"date":"2024-05-24T21:14:16","date_gmt":"2024-05-24T20:14:16","guid":{"rendered":"https:\/\/liora.io\/en\/?p=180027"},"modified":"2026-02-06T08:00:10","modified_gmt":"2026-02-06T07:00:10","slug":"nginx-everything-you-need-to-know-about-this-open-source-web-server","status":"publish","type":"post","link":"https:\/\/liora.io\/en\/nginx-everything-you-need-to-know-about-this-open-source-web-server","title":{"rendered":"NGINX: Everything you need to know about this open source web server"},"content":{"rendered":"<style>\n.elementor-heading-title{padding:0;margin:0;line-height:1}.elementor-widget-heading .elementor-heading-title[class*=elementor-size-]>a{color:inherit;font-size:inherit;line-height:inherit}.elementor-widget-heading .elementor-heading-title.elementor-size-small{font-size:15px}.elementor-widget-heading .elementor-heading-title.elementor-size-medium{font-size:19px}.elementor-widget-heading .elementor-heading-title.elementor-size-large{font-size:29px}.elementor-widget-heading .elementor-heading-title.elementor-size-xl{font-size:39px}.elementor-widget-heading .elementor-heading-title.elementor-size-xxl{font-size:59px}<\/style><p><strong>NGINX (pronounced &#8220;engine-x&#8221;) is an open source web server that has gained popularity for its speed, flexibility and reliability. Since its creation in 2004, NGINX has become a popular choice among web developers and system administrators.<\/strong><\/p>\t\t\n\t\t\t<h3>NGINX history<\/h3>\t\t\n\t\t<p><strong>NGINX<\/strong> was first conceived in 2002 by a Russian engineer named Igor Sysoev, with the main aim of solving the C10K problem. The C10K problem refers to the technical challenge of simultaneously managing 10,000 client connections, a task that was difficult for many <a href=\"https:\/\/liora.io\/en\/microsoft-sql-server-everything-you-need-to-know\">web servers at the time.<\/a><\/p><p><strong> NGINX<\/strong> was officially launched in 2004 after two years of intensive development, and was enthusiastically received by the technology community for its ability to handle large numbers of simultaneous connections with low memory usage.<\/p><p>Today, <strong>NGINX<\/strong> is recognized as one of the world&#8217;s most popular web servers, used by millions of websites and supported by an active community of developers and system administrators. It continues to push the limits of what web servers can do, while remaining true to its origins as an efficient, high-performance solution to the C10K problem.<\/p>\t\t\n\t\t\t<h3>What are the main features of NGINX?<\/h3>\t\t\n\t\t<p>NGINX offers a range of features that make it extremely versatile and capable of meeting a multitude of web content delivery needs?<\/p>\t\t\n\t\t\t<style type=\"text\/css\">\n.tg  {border-collapse:collapse;border-spacing:0;}\n.tg td{border-color:black;border-style:solid;border-width:1px;font-family:Arial, sans-serif;font-size:14px;\n  overflow:hidden;padding:10px 5px;word-break:normal;}\n.tg th{border-color:black;border-style:solid;border-width:1px;font-family:Arial, sans-serif;font-size:14px;\n  font-weight:normal;overflow:hidden;padding:10px 5px;word-break:normal;}\n.tg .tg-i7vj{background-color:#c0c0c0;font-family:\"Trebuchet MS\", Helvetica, sans-serif !important;font-size:14px;font-weight:bold;\n  text-align:left;vertical-align:top}\n.tg .tg-y6fn{background-color:#c0c0c0;text-align:left;vertical-align:top}\n.tg .tg-tvfv{background-color:#ffffff;font-family:\"Trebuchet MS\", Helvetica, sans-serif !important;font-size:16px;text-align:left;\n  vertical-align:top}\n<\/style>\n<table style=\"undefined;table-layout: fixed; width: 800px\">\n<colgroup>\n<col style=\"width: 100px\">\n<col style=\"width: 150px\">\n<col style=\"width: 550px\">\n<\/colgroup>\n<thead>\n  <tr>\n    <th><img decoding=\"async\" src=\"https:\/\/liora.io\/app\/uploads\/2023\/07\/image6-4.png\" alt=\"Image\" width=\"100\" height=\"100\"><\/th>\n    <th>Web Server<\/th>\n    <th>As a web server, NGINX excels in performance and efficiency. Unlike other web servers that use a thread or process for each connection, NGINX utilizes an event-driven architecture, enabling it to handle a large number of simultaneous connections with minimal usage of system resources. This translates to the ability to serve more clients with fewer resources, which can be a significant advantage for high-traffic sites.<\/th>\n  <\/tr>\n<\/thead>\n<tbody>\n  <tr>\n    <td><img decoding=\"async\" src=\"https:\/\/liora.io\/app\/uploads\/2023\/07\/image2-6.png\" alt=\"Image\" width=\"100\" height=\"100\"><\/td>\n    <td>Reverse Proxy<\/td>\n    <td>A Reverse Proxy is a server that sits between clients and one or more web servers, forwarding client requests to the appropriate servers. NGINX can be configured as a Reverse Proxy, allowing efficient traffic distribution, content caching, and protection against DDoS attacks.<\/td>\n  <\/tr>\n  <tr>\n    <td><img decoding=\"async\" src=\"https:\/\/liora.io\/app\/uploads\/2023\/07\/image4-6.png\" alt=\"Image\" width=\"100\" height=\"100\"><\/td>\n    <td>Load Balancer<\/td>\n    <td>Load balancing is a technique that involves distributing network traffic across multiple servers to optimize resource usage, maximize throughput, minimize response time, and prevent overload of a single server. NGINX offers robust load balancing capabilities, with multiple load distribution algorithms and the ability to perform URL-based load balancing.<\/td>\n  <\/tr>\n  <tr>\n    <td><img decoding=\"async\" src=\"https:\/\/liora.io\/app\/uploads\/2023\/07\/image1-5.png\" alt=\"Image\" width=\"100\" height=\"100\"><\/td>\n    <td>HTTP Caching<\/td>\n    <td>NGINX can also be used for HTTP caching, storing HTTP responses locally to accelerate responses to certain requests. By caching commonly requested responses, NGINX can improve response times and reduce load on the origin server.<\/td>\n  <\/tr>\n  <tr>\n    <td><img decoding=\"async\" src=\"https:\/\/liora.io\/app\/uploads\/2023\/07\/image5-3.png\" alt=\"Image\" width=\"100\" height=\"100\"><\/td>\n    <td>SSL &amp; TLS Support<\/td>\n    <td>NGINX supports SSL and TLS for secure communication between client and server. It can also be used to terminate or initiate SSL\/TLS connections, offloading SSL\/TLS processing from application servers and improving performance.<\/td>\n  <\/tr>\n<\/tbody>\n<\/table>\n\t\t\t\n<div class=\"wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex is-content-justification-center\"><div class=\"wp-block-button \"><a class=\"wp-block-button__link wp-element-button \" href=\"\/en\/courses\/data-ai\/\">Mastering NGINX functionalities<\/a><\/div><\/div>\n\n\t\t\t<h3>Installing NGINX<\/h3>\t\t\n\t\t<p>Installing NGINX is a straightforward process.<\/p>\t\t\n\t\t\t<h4>1. Installation on Linux<\/h4>\t\t\n\t\t<p>On most<a href=\"https:\/\/liora.io\/en\/linux-the-preferred-os-for-developers\"> Linux<\/a> distributions,<strong> NGINX<\/strong> can be installed directly from the package repositories. For example, on an Ubuntu or Debian system, you can use the following command:<\/p>\t\t\n\t\t\t<pre data-line=\"\">\t\t\t\t<code readonly=\"true\">\n\t\t\t\t\t<xmp>sudo apt-get update\nsudo apt-get install nginx<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<p>Sur une distribution bas\u00e9e sur CentOS ou Fedora, vous pouvez utiliser la commande suivante :<\/p>\t\t\n\t\t\t<pre data-line=\"\">\t\t\t\t<code readonly=\"true\">\n\t\t\t\t\t<xmp>sudo yum install nginx<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t\t<h4>2. Installation on Windows<\/h4>\t\t\n\t\t<p>NGINX is not officially supported on Windows, but a development version is available that can be used for non-critical testing and development. Download the latest version of NGINX at this address, and unzip the archive.<\/p>\t\t\n\t\t\t<h4>3. Installation on macOS<\/h4>\t\t\n\t\t<p>On macOS, you can install NGINX via Homebrew, a popular package manager for macOS. You can use the following command:<\/p>\t\t\n\t\t\t<pre data-line=\"\">\t\t\t\t<code readonly=\"true\">\n\t\t\t\t\t<xmp>brew install nginx<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t\t<h4>4. Running the NGINX server<\/h4>\t\t\n\t\t<p>Once NGINX has been installed, you can start it using the appropriate command for your system. On a Linux system, you can use the following command:<\/p>\t\t\n\t\t\t<pre data-line=\"\">\t\t\t\t<code readonly=\"true\">\n\t\t\t\t\t<xmp>sudo service nginx start<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<p>After starting NGINX, you should be able to access the default NGINX home page by opening a web browser and navigating to http:\/\/localhost.<\/p>\t\t\n\t\t\t<h3>Basic NGINX configuration<\/h3>\t\t\n\t\t<p>Once NGINX has been installed, configuration is managed using text files located in the NGINX configuration directory, usually \/etc\/nginx. The main file is called nginx.conf, but most site-specific configurations are usually placed in separate files in the sites-available subdirectory.<\/p><p>To configure NGINX to serve a simple website, you can create a new configuration file in the sites-available directory. For example, you could create a file called mywebsite with the following contents:<\/p>\t\t\n\t\t\t<pre data-line=\"\">\t\t\t\t<code readonly=\"true\">\n\t\t\t\t\t<xmp>server {\n    listen 80;\n    server_name mywebsite.com;\n    location \/ {\n        root \/var\/www\/mywebsite;\n        index index.html;\n    }\n}<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<p>This configuration tells NGINX to listen on port 80 for requests to mywebsite.com, and to serve files from the \/var\/www\/mywebsite directory.<\/p><p>After saving your configuration, you can activate your site by creating a symbolic link to your configuration file in the sites-enabled directory, then restarting NGINX :<\/p>\t\t\n\t\t\t<pre data-line=\"\">\t\t\t\t<code readonly=\"true\">\n\t\t\t\t\t<xmp>sudo ln -s \/etc\/nginx\/sites-available\/mywebsite \/etc\/nginx\/sites-enabled\/\nsudo service nginx restart<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<p>Your website should now be accessible via NGINX.<\/p>\t\t\n\t\t\t<h3>Conclusion<\/h3>\t\t\n\t\t<p><strong>NGINX<\/strong> is a robust web server capable of handling large numbers of simultaneous connections with minimal resource utilization. But beyond that, its versatility as a <strong>Reverse Proxy, Load Balancer, HTTP Caching<\/strong> and much more, makes NGINX a solid choice for anyone looking to optimize and secure their web infrastructure.<\/p>\t\t\n\t\t\t\n<div class=\"wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex is-content-justification-center\"><div class=\"wp-block-button \"><a class=\"wp-block-button__link wp-element-button \" href=\"\/en\/courses\/data-ai\/\">Learning to use NGINX<\/a><\/div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>NGINX (pronounced &#8220;engine-x&#8221;) is an open source web server that has gained popularity for its speed, flexibility and reliability. Since its creation in 2004, NGINX has become a popular choice among web developers and system administrators. NGINX history NGINX was first conceived in 2002 by a Russian engineer named Igor Sysoev, with the main aim [&hellip;]<\/p>\n","protected":false},"author":76,"featured_media":180041,"comment_status":"open","ping_status":"open","sticky":false,"template":"elementor_theme","format":"standard","meta":{"_acf_changed":false,"editor_notices":[],"footnotes":""},"categories":[2434],"class_list":["post-180027","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cloud-dev"],"acf":[],"_links":{"self":[{"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/posts\/180027","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/users\/76"}],"replies":[{"embeddable":true,"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/comments?post=180027"}],"version-history":[{"count":1,"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/posts\/180027\/revisions"}],"predecessor-version":[{"id":205719,"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/posts\/180027\/revisions\/205719"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/media\/180041"}],"wp:attachment":[{"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/media?parent=180027"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/categories?post=180027"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}