LinuxWindows

Where Is the Nginx Config File?

On Linux the main nginx.conf lives under /etc/nginx with sites split into included folders, while Windows keeps it beside the exe.

Last updated

Nginx reads one main file that pulls in everything else through include lines. Server blocks usually live apart from it, which confuses anyone expecting a single giant config.

Debian and Ubuntu split sites across sites-available and sites-enabled with symlinks between them. RHEL style distros use conf.d instead. Always run nginx -t before reloading. It catches syntax slips without touching the running server.

Where Nginx stores this, by platform

Linux
/etc/nginx/nginx.conf

Site files at /etc/nginx/sites-enabled on Debian/Ubuntu or /etc/nginx/conf.d on RHEL. Test edits with nginx -t, then reload with systemctl reload nginx.

Windows
C:\nginx\conf\nginx.conf

No sites-enabled split by default. The stock Windows build logs beside it under C:\nginx\logs unless the config says otherwise.

Frequently asked questions

Where are Nginx access and error logs?

Defaults are /var/log/nginx/access.log and error.log on Linux. The config can move them per site, so check the access_log and error_log lines when a path looks wrong.

Why is my new site file ignored?

On Debian layouts a file in sites-available does nothing until symlinked into sites-enabled. Create the link, run nginx -t, then reload.

Notice an outdated path? Let us know.