Skip to content

Commit 14b8ccf

Browse files
committed
Block access to sensitive files and directories
New blocked files/directories: .env - Environment variables .svn - Subversion composer.json, composer.lock - PHP dependencies package.json, package-lock.json - Node dependencies .user.ini - PHP configuration .bak, .config, .sql, .log, .sh, .ini, .inc, .swp, .dist
1 parent 8e84aec commit 14b8ccf

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

nginx/conf.d/default.conf

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,36 @@ server {
3535
fastcgi_read_timeout 300;
3636
}
3737

38+
# Block access to sensitive files and directories
3839
location ~ /\.git {
3940
deny all;
4041
}
4142

4243
location ~ /\.ht {
4344
deny all;
4445
}
46+
47+
location ~ /\.env {
48+
deny all;
49+
}
50+
51+
location ~ /\.svn {
52+
deny all;
53+
}
54+
55+
location ~ /composer\.(json|lock)$ {
56+
deny all;
57+
}
58+
59+
location ~ /package(-lock)?\.json$ {
60+
deny all;
61+
}
62+
63+
location ~ /\.user\.ini$ {
64+
deny all;
65+
}
66+
67+
location ~ /\.(bak|config|sql|fla|psd|ini|log|sh|inc|swp|dist)$ {
68+
deny all;
69+
}
4570
}

0 commit comments

Comments
 (0)