{
  "id": 22029544,
  "title": "Nginx Hardening Checklist",
  "url": "https://urgent.news/2026/11/26/nginx-hardening-checklist",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-11-26T19:18:24.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/cerberusguard/nginx-hardening-checklist-56fa"
  },
  "original_language": "en",
  "account": "1. Ensure Nginx and OpenSSL are kept up-to-date. Version numbers can be seen via nginx -V, while testing the configuration with nginx -T is advised. Update OpenSSL if needed.\n2. Hide the Nginx version by setting server_tokens off; this stops version information from being displayed on error pages and in headers.\n3. Use modern TLS protocols only: SSL module docs suggest TLSv1.2 and TLSv1.3 as the default. Cipher suites can be tested using Mozilla SSL Configuration Generator.\n4. Redirect HTTP traffic and implement HSTS: HTTP requests can be redirected to HTTPS using a 301 return. HSTS headers can be added with add_header Strict-Transport-Security \"max-age=31536000\" always;\n5. Properly use and inherit security headers: add_header directives can be inherited from a higher level only if no add_header is defined on the current level. Two more details include setting X-Content-Type-Options and Content-Security-Policy headers.\n6. Refuse unknown hosts: Create a default server block that rejects requests with a Host header that no other server block matches.\n7. Disable directory listings and hide dotfiles: autoindex should be off and deny access to hidden files such as .git or .env while allowing access to .well-known for certificate renewal.\n8. Set request size and rate limits: client_max_body_size should be adjusted per location according to the application's needs. Rate limits can be implemented using limit_req_zone to prevent brute-force attacks and scraping.\n9. Restrict admin and status endpoints: Pages like stub_status and admin panels should not be publicly accessible. Restrict access to these pages using a location block with the allow and deny directives.\n10. Run workers unprivileged and lock down files: The master process should run as root to bind ports, while workers should run as an unprivileged user. Config files and private keys should have restricted permissions to root only, and web roots should not be writable by the worker user unless necessary.\n11. Manage proxy and alias settings: Only forward headers necessary for the application and ensure that X-Forwarded-For is trusted only from the proxy. When using alias, keep trailing slashes consistent between the location and the path.\n12. Follow the common Nginx misconfigurations guide for more detailed information.",
  "summary": "Nginx ships with sensible defaults, but a default install is not a hardened one. Version numbers leak in headers, old virtual hosts answer for any hostname, security headers vanish on error pages, and upload limits are whatever someone set three years ago. This nginx hardening checklist walks through the checks worth running on any server you are responsible for, with short config snippets and a…",
  "key_points": [
    "Ensure Nginx and OpenSSL are up-to-date",
    "Hide Nginx version by setting servertokens off",
    "Redirect HTTP traffic and implement HSTS"
  ],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}