1. Paste your config
Name each block like its path. include conf.d/*.conf; in one block pulls in every block whose name ends in conf.d/something.conf, in name order, the way nginx does.
Paste at least one nginx config file above and click Check.
Findings
| File : Line | Type | Risk | Fix |
|---|
What it checks
- High:
aliasoff-by-slash path traversal;$urior$document_uriin a redirect, a header or the upstream path (CRLF injection);proxy_passto a host from a query argument, header or cookie (SSRF);Access-Control-Allow-Origin $http_originwith credentials;SSLv2/SSLv3. - Medium:
add_headerin a nested block dropping the enclosing ones;denyafterallow all;autoindex on; open redirects; unanchored$http_originregexes; TLS 1.0/1.1 and weak ciphers;proxy_pass http://$host; a publicstub_status. - Low:
server_tokens on;proxy_set_header Host $http_host; unverified upstream TLS;valid_referers none;client_max_body_size 0.
Several of these were first catalogued by Yandex's Gixy, a Python analyser; this is an independent implementation and is not affiliated with it. Every type, with the nginx behaviour behind it: nginx misconfigurations explained.
Prefer a CLI, or want this in your own CI?
Same engine, zero dependencies, Node 18 or later:
node check.mjs /etc/nginx/ # a whole config tree, includes resolved
node check.mjs site.conf --format json # machine-readable
node check.mjs . --fail-on-risk # exit 2 on any high or medium finding
Get check.mjs and scan.mjs from the repo: nothing to install, no network calls, and it never runs nginx.
Common questions
Why does my add_header not work inside a location block?
It does, but it switches off the others. The nginx documentation says add_header directives are inherited from the previous configuration level if and only if there are no add_header directives on the current level. So one add_header in a location drops every header set in server or http for that location, such as Strict-Transport-Security or X-Frame-Options. Repeat them in the location (an include file keeps them in one place) or, on nginx 1.29.3 or later, set add_header_inherit merge; at the top.
What is the nginx alias off-by-slash vulnerability?
A prefix location without a trailing slash, such as location /img, with an alias that has one, such as alias /data/img/, lets a request for /img../ map to /data/img/../, the directory above. Make the two agree: location /img/ with alias /data/img/.
Why is $uri dangerous in an nginx redirect?
$uri holds the normalised, decoded path, so an encoded line break (%0d%0a) in the request becomes a real line break in the Location header, and an attacker can add headers of their own. $request_uri keeps the client's original encoding: return 301 https://$host$request_uri;
Is this the same as nginx -t?
No. nginx -t checks that nginx will accept the configuration. This tool reads the files for risky settings that nginx accepts without complaint, and it works on files in a repository or an image before they reach a server. Run both.
Does a clean result mean my nginx server is secure?
No. It reads only the patterns listed on this page, does not know your nginx version, does not follow map, geo or set values, and cannot see the application behind proxy_pass. Have a qualified person review anything that protects valuable data.