Skip to content

nginx config security checker

Free, no sign-up Runs in your browser

Paste nginx.conf and find alias path traversal, $uri redirects, old TLS, weak ciphers, missing security headers and the add_header inheritance trap.

Checked as you type. Nothing you paste leaves this page.

The file is read in your browser. It is not uploaded.

Everything you type here stays in your browser. Nothing is sent to HardenKit or to anyone else.

How to use the nginx config security checker

  1. Paste nginx.conf or a site file, drop it, or load the example.
  2. Fix high findings first: path traversal, header injection and request forgery.
  3. For dropped headers, repeat them in the block, or include one shared file at both levels.
  4. Reload with nginx -t first to confirm the syntax.

About this tool

nginx does what its configuration says, and a few common patterns say more than their author meant. A location without a trailing slash combined with an alias that has one lets a request climb out of the directory. A redirect built from $uri lets an attacker inject response headers. A proxy_pass whose host comes from the request turns the server into an open relay to your internal network.

The quietest one is add_header. nginx inherits these directives from the level above only when the current block has none of its own, so a single add_header for caching inside a location drops every security header set in the server block. This checker parses the configuration into its blocks and reports that case with the headers that are lost.

It also reports old TLS protocols, weak ciphers named in ssl_ciphers, autoindex, server_tokens, HTTPS servers with no HSTS, nosniff or frame protection, and unlimited body size. It reads the one file you paste: included files are not followed, so a header or TLS setting that lives in a snippet is invisible to it, and the rules do not replace a review.

Sources

Questions

Why are my nginx security headers missing on some pages?

add_header directives are inherited from the previous level only if the current level defines none. If a location block has its own add_header, for example for Cache-Control, the headers from the server block are not sent for that location. Repeat them there, or on nginx 1.29.3 and later set add_header_inherit merge.

What is the nginx alias path traversal bug?

With location /assets { alias /var/www/static/; } nginx replaces only the matched prefix, so a request for /assets../ maps to the parent of the alias directory. That exposes neighbouring files such as source code and configuration. Write the location with a trailing slash: location /assets/.

Why should I use $request_uri instead of $uri in a redirect?

$uri is the normalized, decoded path, so an encoded line break (%0d%0a) in the request becomes a real one in the Location header. That lets an attacker add headers or split the response. $request_uri is the original request as sent, still encoded.

Which TLS versions should nginx allow?

TLS 1.2 and 1.3. SSLv3 is broken, and TLS 1.0 and 1.1 were deprecated by RFC 8996 in 2021 and removed from browsers. Use ssl_protocols TLSv1.2 TLSv1.3; and a cipher list from the Mozilla SSL Configuration Generator.

Related tools