nginx.conf best practices

Best practices for nginx.conf configuration files

Hide server_tokens

Disable the server_tokens HTTP header response to hide the Nginx version.

Allow only GET, POST, HEAD HTTP Methods

There are multiple HTTP Methods that are enabled by default. If your project uses only GET, POST and HEAD, you can disable the other methods such as DELETE, TRACE.

Don't use root inside location

Don't use root inside a location {} block directive except when you want to override the location.