How to disable access to hidden folders other than .well-known in nginx


Put the following settings in nginx.conf.

location ~ /\.(?!well-known).* {
    deny all;
}