1. Disable the autoindex module
Add autoindex off in the location block of the configuration file; just declare
2. Disable ssi on the server
This can be done by adding ssi off in the location block;
3. Turn off the server flag
If enabled (by default) all error pages will display the server version and information. Add the server_tokens off; statement to the Nginx configuration file to solve this problem.
4. Set a custom cache in the configuration file to limit the possibility of buffer overflow attacks
client_body_buffer_size 1K;
client_header_buffer_size 1k;
client_max_body_size 1k;
large_client_header_buffers 2 1k;
client_body_timeout 10;
client_header_timeout 10;
keepalive_timeout 5 5;
send_timeout 10;
5. Limit the number of user connections to prevent DOS attacks
limit_zone slimits $binary_remote_addr 5m;
limit_conn slimits 5;