https://github.com/nginx/nginx Skip to content Navigation Menu Toggle navigation Sign in * Product + Actions Automate any workflow + Packages Host and manage packages + Security Find and fix vulnerabilities + Codespaces Instant dev environments + GitHub Copilot Write better code with AI + Code review Manage code changes + Issues Plan and track work + Discussions Collaborate outside of code Explore + All features + Documentation + GitHub Skills + Blog * Solutions By size + Enterprise + Teams + Startups By industry + Healthcare + Financial services + Manufacturing By use case + CI/CD & Automation + DevOps + DevSecOps * Resources Topics + AI + DevOps + Security + Software Development + View all Explore + Learning Pathways + White papers, Ebooks, Webinars + Customer Stories + Partners * Open Source + GitHub Sponsors Fund open source developers + The ReadME Project GitHub community articles Repositories + Topics + Trending + Collections * Enterprise + Enterprise platform AI-powered developer platform Available add-ons + Advanced Security Enterprise-grade security features + GitHub Copilot Enterprise-grade AI features + Premium Support Enterprise-grade 24/7 support * Pricing Search or jump to... Search code, repositories, users, issues, pull requests... Search [ ] Clear Search syntax tips Provide feedback We read every piece of feedback, and take your input very seriously. [ ] [ ] Include my email address so I can be contacted Cancel Submit feedback Saved searches Use saved searches to filter your results more quickly Name [ ] Query [ ] To see all available qualifiers, see our documentation. Cancel Create saved search Sign in Sign up Reseting focus You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert {{ message }} nginx / nginx Public * Notifications You must be signed in to change notification settings * Fork 6.9k * Star 24.5k The official NGINX Open Source repository. nginx.org/ License BSD-2-Clause license 24.5k stars 6.9k forks Branches Tags Activity Star Notifications You must be signed in to change notification settings * Code * Issues 30 * Pull requests 19 * Discussions * Actions * Security * Insights Additional navigation options * Code * Issues * Pull requests * Discussions * Actions * Security * Insights nginx/nginx This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. master BranchesTags Go to file Code Folders and files Name Name Last commit Last commit message date Latest commit History 8,278 Commits .github .github auto auto conf conf contrib contrib docs docs misc misc src src CODE_OF_CONDUCT.md CODE_OF_CONDUCT.md CONTRIBUTING.md CONTRIBUTING.md LICENSE LICENSE README.md README.md SECURITY.md SECURITY.md View all files Repository files navigation * README * Code of conduct * BSD-2-Clause license * Security NGINX (pronounced "engine x" or "en-jin-eks") is the world's most popular Web Server, high performance Load Balancer, Reverse Proxy, API Gateway and Content Cache. NGINX is free and open source software, distributed under the terms of a simplified 2-clause BSD-like license. Enterprise distributions, commercial support and training are available from F5, Inc. Important The goal of this README is to provide a basic, structured introduction to NGINX for novice users. Please refer to the full NGINX documentation for detailed information on installing, building, configuring, debugging, and more. These documentation pages also contain a more detailed Beginners Guide, How-Tos, Development guide, and a complete module and directive reference. Table of contents * How it works + Modules + Configurations + Runtime * Downloading and installing + Stable and Mainline binaries + Linux binary installation process + FreeBSD installation process + Windows executables + Dynamic modules * Getting started with NGINX + Installing SSL certificates and enabling TLS encryption + Load Balancing + Rate limiting + Content caching * Building from source + Installing dependencies + Cloning the NGINX GitHub repository + Configuring the build + Compiling + Location of binary and installation + Running and testing the installed binary * Asking questions and reporting issues * Contributing code * Additional help and resources * Changelog * License How it works NGINX is installed software with binary packages available for all major operating systems and Linux distributions. See Tested OS and Platforms for a full list of compatible systems. Important While nearly all popular Linux-based operating systems are distributed with a community version of nginx, we highly advise installation and usage of official packages or sources from this repository. Doing so ensures that you're using the most recent release or source code, including the latest feature-set, fixes and security patches. Modules NGINX is comprised of individual modules, each extending core functionality by providing additional, configurable features. See "Modules reference" at the bottom of nginx documentation for a complete list of official modules. NGINX modules can be built and distributed as static or dynamic modules. Static modules are defined at build-time, compiled, and distributed in the resulting binaries. See Dynamic Modules for more information on how they work, as well as, how to obtain, install, and configure them. Tip You can issue the following command to see which static modules your NGINX binaries were built with: nginx -V See Configuring the build for information on how to include specific Static modules into your nginx build. Configurations NGINX is highly flexible and configurable. Provisioning the software is achieved via text-based config file(s) accepting parameters called "Directives". See Configuration File's Structure for a comprehensive description of how NGINX configuration files work. Note The set of directives available to your distribution of NGINX is dependent on which modules have been made available to it. Runtime Rather than running in a single, monolithic process, NGINX is architected to scale beyond Operating System process limitations by operating as a collection of processes. They include: * A "master" process that maintains worker processes, as well as, reads and evaluates configuration files. * One or more "worker" processes that process data (eg. HTTP requests). The number of worker processes is defined in the configuration file and may be fixed for a given configuration or automatically adjusted to the number of available CPU cores. In most cases, the latter option optimally balances load across available system resources, as NGINX is designed to efficiently distribute work across all worker processes. Tip Processes synchronize data through shared memory. For this reason, many NGINX directives require the allocation of shared memory zones. As an example, when configuring rate limiting, connecting clients may need to be tracked in a common memory zone so all worker processes can know how many times a particular client has accessed the server in a span of time. Downloading and installing Follow these steps to download and install precompiled NGINX binaries. You may also choose to build NGINX locally from source code . Stable and Mainline binaries NGINX binaries are built and distributed in two versions: stable and mainline. Stable binaries are built from stable branches and only contain critical fixes backported from the mainline version. Mainline binaries are built from the master branch and contain the latest features and bugfixes. You'll need to decide which is appropriate for your purposes. Linux binary installation process The NGINX binary installation process takes advantage of package managers native to specific Linux distributions. For this reason, first-time installations involve adding the official NGINX package repository to your system's package manager. Follow these steps to download, verify, and install NGINX binaries using the package manager appropriate for your Linux distribution. Upgrades Future upgrades to the latest version can be managed using the same package manager without the need to manually download and verify binaries. FreeBSD installation process For more information on installing NGINX on FreeBSD system, visit https://nginx.org/en/docs/install.html Windows executables Windows executables for mainline and stable releases can be found on the main NGINX download page. Note that the current implementation of NGINX for Windows is at the Proof-of-Concept stage and should only be used for development and testing purposes. For additional information, please see nginx for Windows. Dynamic modules NGINX version 1.9.11 added support for Dynamic Modules. Unlike Static modules, dynamically built modules can be downloaded, installed, and configured after the core NGINX binaries have been built. Official dynamic module binaries are available from the same package repository as the core NGINX binaries described in previous steps. Tip NGINX JavaScript (njs), is a popular NGINX dynamic module that enables the extension of core NGINX functionality using familiar JavaScript syntax. Important If desired, dynamic modules can also be built statically into NGINX at compile time. Getting started with NGINX For a gentle introduction to NGINX basics, please see our Beginner's Guide. Installing SSL certificates and enabling TLS encryption See Configuring HTTPS servers for a quick guide on how to enable secure traffic to your NGINX installation. Load Balancing For a quick start guide on configuring NGINX as a Load Balancer, please see Using nginx as HTTP load balancer. Rate limiting See our Rate Limiting with NGINX blog post for an overview of core concepts for provisioning NGINX as an API Gateway. Content caching See A Guide to Caching with NGINX and NGINX Plus blog post for an overview of how to use NGINX as a content cache (e.g. edge server of a content delivery network). Building from source The following steps can be used to build NGINX from source code available in this repository. Installing dependencies Most Linux distributions will require several dependencies to be installed in order to build NGINX. The following instructions are specific to the apt package manager, widely available on most Ubuntu/ Debian distributions and their derivatives. Tip It is always a good idea to update your package repository lists prior to installing new packages. sudo apt update Installing compiler and make utility Use the following command to install the GNU C compiler and Make utility. sudo apt install gcc make Installing dependency libraries sudo apt install libpcre3-dev zlib1g-dev Warning This is the minimal set of dependency libraries needed to build NGINX with rewriting and gzip capabilities. Other dependencies may be required if you choose to build NGINX with additional modules. Monitor the output of the configure command discussed in the following sections for information on which modules may be missing. For example, if you plan to use SSL certificates to encrypt traffic with TLS, you'll need to install the OpenSSL library. To do so, issue the following command. sudo apt install libssl-dev Cloning the NGINX GitHub repository Using your preferred method, clone the NGINX repository into your development directory. See Cloning a GitHub Repository for additional help. git clone https://github.com/nginx/nginx.git Configuring the build Prior to building NGINX, you must run the configure script with appropriate flags. This will generate a Makefile in your NGINX source root directory that can then be used to compile NGINX with options specified during configuration. From the NGINX source code repository's root directory: auto/configure Important Configuring the build without any flags will compile NGINX with the default set of options. Please refer to https://nginx.org/en/docs/ configure.html for a full list of available build configuration options. Compiling The configure script will generate a Makefile in the NGINX source root directory upon successful execution. To compile NGINX into a binary, issue the following command from that same directory: make Location of binary and installation After successful compilation, a binary will be generated at /objs/nginx. To install this binary, issue the following command from the source root directory: sudo make install Important The binary will be installed into the /usr/local/nginx/ directory. Running and testing the installed binary To run the installed binary, issue the following command: sudo /usr/local/nginx/sbin/nginx You may test NGINX operation using curl. curl localhost The output of which should start with: Welcome to nginx! Asking questions and reporting issues We encourage you to engage with us. * NGINX GitHub Discussions, is the go-to place to start asking questions and sharing your thoughts. * Our GitHub Issues page offers space to submit and discuss specific issues, report bugs, and suggest enhancements. Contributing code Please see the Contributing guide for information on how to contribute code. Additional help and resources * See the NGINX Community Blog for more tips, tricks and HOW-TOs related to NGINX and related projects. * Access nginx.org, your go-to source for all documentation, information and software related to the NGINX suite of projects. Changelog See our changelog to keep track of updates. License 2-clause BSD-like license --------------------------------------------------------------------- Additional documentation available at: https://nginx.org/en/docs About The official NGINX Open Source repository. nginx.org/ Resources Readme License BSD-2-Clause license Code of conduct Code of conduct Security policy Security policy Activity Custom properties Stars 24.5k stars Watchers 990 watching Forks 6.9k forks Report repository Contributors 73 * @mdounin * @vl-homutov * @arut * @VBart * @PiotrSikora * @defanator * @pluknet * @cubicdaiya * @mtbChef * @agentzh * @flygoast * @kou * @fblr * @chobits + 59 contributors Languages * C 97.6% * Vim Script 1.8% * XS 0.4% * Perl 0.1% * Makefile 0.1% * Shell 0.0% Footer (c) 2024 GitHub, Inc. Footer navigation * Terms * Privacy * Security * Status * Docs * Contact * Manage cookies * Do not share my personal information You can't perform that action at this time.