{
    "title": "Nginx",
    "seo_title": "Nginx: definition, how it works and use with WordPress",
    "h1": "Nginx",
    "description": "Nginx: its master and worker model, passing scripts to PHP-FPM, the lack of .htaccess and how to configure WordPress permalinks.",
    "lead": "Nginx (pronounced “engine-x”) is an open source, event-driven web server that also works as a reverse proxy, load balancer and HTTP cache. Light on memory even with many simultaneous connections, it passes PHP scripts to PHP-FPM and doesn't read .htaccess files.",
    "language": "en",
    "locale": "en-US",
    "type": "definition",
    "url": "https://www.wp-feint.com/glossary/nginx/",
    "canonical": "https://www.wp-feint.com/glossary/nginx/",
    "markdown": "https://www.wp-feint.com/glossary/nginx/index.md",
    "json": "https://www.wp-feint.com/glossary/nginx/index.json",
    "published": "2026-10-28T08:00:00+00:00",
    "modified": "2026-11-22T12:08:03+00:00",
    "site": {
        "name": "WP Feint",
        "url": "https://www.wp-feint.com/"
    },
    "translations": [
        {
            "language": "en",
            "hreflang": "en-US",
            "title": "Nginx",
            "url": "https://www.wp-feint.com/glossary/nginx/",
            "markdown": "https://www.wp-feint.com/glossary/nginx/index.md",
            "json": "https://www.wp-feint.com/glossary/nginx/index.json"
        },
        {
            "language": "fr",
            "hreflang": "fr-FR",
            "title": "Nginx",
            "url": "https://www.wp-feint.com/fr/definitions/nginx/",
            "markdown": "https://www.wp-feint.com/fr/definitions/nginx/index.md",
            "json": "https://www.wp-feint.com/fr/definitions/nginx/index.json"
        },
        {
            "language": "es",
            "hreflang": "es-ES",
            "title": "Nginx",
            "url": "https://www.wp-feint.com/es/glosario/nginx/",
            "markdown": "https://www.wp-feint.com/es/glosario/nginx/index.md",
            "json": "https://www.wp-feint.com/es/glosario/nginx/index.json"
        },
        {
            "language": "de",
            "hreflang": "de-DE",
            "title": "Nginx",
            "url": "https://www.wp-feint.com/de/glossar/nginx/",
            "markdown": "https://www.wp-feint.com/de/glossar/nginx/index.md",
            "json": "https://www.wp-feint.com/de/glossar/nginx/index.json"
        },
        {
            "language": "it",
            "hreflang": "it-IT",
            "title": "Nginx",
            "url": "https://www.wp-feint.com/it/glossario/nginx/",
            "markdown": "https://www.wp-feint.com/it/glossario/nginx/index.md",
            "json": "https://www.wp-feint.com/it/glossario/nginx/index.json"
        },
        {
            "language": "pt",
            "hreflang": "pt-BR",
            "title": "Nginx",
            "url": "https://www.wp-feint.com/pt/glossario/nginx/",
            "markdown": "https://www.wp-feint.com/pt/glossario/nginx/index.md",
            "json": "https://www.wp-feint.com/pt/glossario/nginx/index.json"
        },
        {
            "language": "nl",
            "hreflang": "nl-NL",
            "title": "Nginx",
            "url": "https://www.wp-feint.com/nl/woordenlijst/nginx/",
            "markdown": "https://www.wp-feint.com/nl/woordenlijst/nginx/index.md",
            "json": "https://www.wp-feint.com/nl/woordenlijst/nginx/index.json"
        }
    ],
    "headings": [
        {
            "level": 1,
            "text": "Nginx"
        },
        {
            "level": 2,
            "text": "How Nginx works"
        },
        {
            "level": 2,
            "text": "Nginx and PHP"
        },
        {
            "level": 2,
            "text": "No .htaccess"
        },
        {
            "level": 2,
            "text": "For WordPress"
        },
        {
            "level": 2,
            "text": "Common mistakes"
        }
    ],
    "body": "Built to handle a large number of simultaneous connections, Nginx has become a leading web server, used on its own or as a reverse proxy in front of other servers. WordPress recommends it, alongside Apache, as one of the most robust servers for hosting the CMS.\n\n## How Nginx works\n\nAccording to its documentation, Nginx runs one master process and several worker processes. The master reads and validates the configuration and manages the workers; the workers do the actual request processing, using an event-driven model. Instead of dedicating a process or thread to each connection, each worker keeps track of many connections at once and reacts as soon as one of them is ready. The number of workers is often set to the number of CPU cores.\n\nThe configuration lives in the [nginx.conf](https://www.wp-feint.com/glossary/nginx-conf/) file and its includes. A change only takes effect after a reload (`nginx -s reload`): the master checks the new configuration, starts new workers and gracefully shuts down the old ones, or keeps the old configuration if the new one contains an error.\n\n## Nginx and PHP\n\nNginx doesn't run PHP itself. It passes scripts to a FastCGI server, almost always [PHP-FPM](https://www.wp-feint.com/glossary/php-fpm/), with the `fastcgi_pass` directive. The exchange goes through a Unix socket or a local port; the PHP documentation warns that a FastCGI endpoint exposed to the network allows arbitrary code execution, which is why a socket is preferred when everything runs on the same machine.\n\n![Diagram of a WordPress request's path with Nginx: the browser requests a page, an Nginx worker handles it in its event loop, try_files looks for an existing file and serves images, CSS and JavaScript directly, otherwise the request is rewritten to index.php, fastcgi_pass forwards it to PHP-FPM through a socket, and a PHP-FPM worker runs WordPress.](https://www.wp-feint.com/media/2026/10/nginx-php-fpm-en.webp)\n\n## No .htaccess\n\nThis is the difference that surprises people coming from [Apache](https://www.wp-feint.com/glossary/apache-http-server/) the most: the WordPress documentation points out that Nginx has no per-directory configuration file like [.htaccess](https://www.wp-feint.com/glossary/htaccess/). Everything is configured at the server level, and WordPress can't write its own rewrite rules. For permalinks, the key line is:\n\n```\nlocation / {\n    try_files $uri $uri/ /index.php?$args;\n}\n```\n\nIt serves the requested file or folder if it exists, and otherwise passes the request to index.php, keeping the URL parameters. Without it, custom permalinks return 404 errors.\n\n*Video: “Apache vs NGINX” (IBM Technology)*\n\n## For WordPress\n\n- **Plugin rules don't apply on their own**: a plugin that writes to .htaccess (caching, security, redirects) has no effect on Nginx. Its rules have to be carried over into the configuration, or you have to ask the host to do it.\n- **Protect the admin area and sensitive files** with `location` blocks, as shown in our guide to protecting wp-admin at the server level.\n- **Behind a CDN or a proxy**, configure the real_ip module to recover the visitor's address; see [Cloudflare in front of WordPress](https://www.wp-feint.com/cloudflare-wordpress-real-visitor-ip/).\n- **Reload after every change**, and test the configuration first with `nginx -t`.\n\nWP Feint works on Nginx without server rules, with two exceptions: the Pro version's file aliases, for which the plugin generates the block to copy, and one line that hides the plugin's folder, as explained on the [hosting and cache compatibility](https://www.wp-feint.com/features/hosting-and-cache-compatibility/) page.\n\n## Common mistakes\n\nAdding protections to an .htaccess file on an Nginx server and thinking the site is protected; leaving PHP-FPM listening on an address reachable from the internet; forgetting `?$args` in try_files, which breaks URLs with parameters. Many hosts also put Nginx in front of Apache: in that case, .htaccess works again for the requests passed on to Apache.\n\n## Related terms\n\n- [Apache HTTP Server](https://www.wp-feint.com/glossary/apache-http-server/)\n- [nginx.conf](https://www.wp-feint.com/glossary/nginx-conf/)\n- [PHP-FPM](https://www.wp-feint.com/glossary/php-fpm/)\n- [htaccess file (.htaccess)](https://www.wp-feint.com/glossary/htaccess/)\n- [LiteSpeed Web Server](https://www.wp-feint.com/glossary/litespeed/)\n\n\n## Sources\n\n- [nginx : Beginner’s Guide](https://nginx.org/en/docs/beginners_guide.html)\n- [WordPress Advanced Administration : Nginx](https://developer.wordpress.org/advanced-administration/server/web-server/nginx/)\n- [PHP Manual : FPM configuration](https://www.php.net/manual/en/install.fpm.configuration.php)",
    "definition": "Nginx (pronounced “engine-x”) is an open source, event-driven web server that also works as a reverse proxy, load balancer and HTTP cache. Light on memory even with many simultaneous connections, it passes PHP scripts to PHP-FPM and doesn't read .htaccess files.",
    "group": "Web hosting",
    "aka": [
        "nginx",
        "engine-x",
        "Nginx web server",
        "reverse proxy"
    ],
    "related": [
        {
            "title": "Apache HTTP Server",
            "url": "https://www.wp-feint.com/glossary/apache-http-server/",
            "markdown": "https://www.wp-feint.com/glossary/apache-http-server/index.md"
        },
        {
            "title": "nginx.conf",
            "url": "https://www.wp-feint.com/glossary/nginx-conf/",
            "markdown": "https://www.wp-feint.com/glossary/nginx-conf/index.md"
        },
        {
            "title": "PHP-FPM",
            "url": "https://www.wp-feint.com/glossary/php-fpm/",
            "markdown": "https://www.wp-feint.com/glossary/php-fpm/index.md"
        },
        {
            "title": "htaccess file (.htaccess)",
            "url": "https://www.wp-feint.com/glossary/htaccess/",
            "markdown": "https://www.wp-feint.com/glossary/htaccess/index.md"
        },
        {
            "title": "LiteSpeed Web Server",
            "url": "https://www.wp-feint.com/glossary/litespeed/",
            "markdown": "https://www.wp-feint.com/glossary/litespeed/index.md"
        }
    ],
    "sources": [
        {
            "title": "nginx : Beginner’s Guide",
            "url": "https://nginx.org/en/docs/beginners_guide.html"
        },
        {
            "title": "WordPress Advanced Administration : Nginx",
            "url": "https://developer.wordpress.org/advanced-administration/server/web-server/nginx/"
        },
        {
            "title": "PHP Manual : FPM configuration",
            "url": "https://www.php.net/manual/en/install.fpm.configuration.php"
        }
    ],
    "format": "application/json"
}