Skip to content

Commit 9a6900b

Browse files
authored
feat: add some Nginx Config Templates (#233)
1 parent 17d6216 commit 9a6900b

File tree

4 files changed

+142
-0
lines changed

4 files changed

+142
-0
lines changed

template/block/drupal_security.conf

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Nginx UI Template Start
2+
name = "Drupal Security"
3+
author = "@sanvu88"
4+
description = { en = "Drupal Security Config", vi_VN = "Cấu hình bảo mật cho Drupal"}
5+
# Nginx UI Template End
6+
7+
location ~ ((^|/)\.|^.*\.yml$|^/sites/.*/private/|^/sites/[^/]+/[^/]*settings.*\.php$) {
8+
return 444;
9+
}
10+
11+
location ~ ^/sites/[^/]+/files/.*\.php$ {
12+
return 444;
13+
}
14+
15+
location ~ /vendor/.*\.php$ {
16+
return 444;
17+
}

template/block/joomla_security.conf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Nginx UI Template Start
2+
name = "Joomla Security"
3+
author = "@sanvu88"
4+
description = { en = "Joomla Security Config", vi_VN = "Cấu hình bảo mật cho Joomla"}
5+
# Nginx UI Template End
6+
7+
location ~* /(images|cache|media|logs|tmp)/.*\.(gz|tar|bzip2|7z|php|php5|php7|log|error|py|pl|kid|love|cgi|shtml|phps|pht|jsp|asp|sh|bash)$ {
8+
return 444;
9+
}

template/block/security_headers.conf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Nginx UI Template Start
2+
name = "Nginx Security Headers"
3+
author = "@sanvu88"
4+
description = { en = "Nginx Security Headers Config", vi_VN = "Cấu hình Headers tăng cường bảo mật"}
5+
# Nginx UI Template End
6+
7+
add_header X-XSS-Protection "1; mode=block" always;
8+
add_header X-Content-Type-Options "nosniff" always;
9+
add_header Referrer-Policy "no-referrer-when-downgrade" always;
10+
add_header Content-Security-Policy "default-src 'self' http: https: ws: wss: data: blob: 'unsafe-inline'; frame-ancestors 'self';" always;
11+
add_header Permissions-Policy "interest-cohort=()" always;
12+
add_header X-Frame-Options "SAMEORIGIN";
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# Nginx UI Template Start
2+
name = "WordPress Security"
3+
author = "@sanvu88"
4+
description = { en = "WordPress Security Config", vi_VN = "Cấu hình bảo mật cho WordPress"}
5+
6+
[variables.blockUserAPI]
7+
type = "boolean"
8+
name = { en = "Block WordPress User API", vi_VN = "Chặn truy cập danh sách user"}
9+
value = true
10+
11+
[variables.blockXMLRPC]
12+
type = "boolean"
13+
name = { en = "Block WordPress XMLRPC", vi_VN = "Chặn truy cập xmlrpc.php"}
14+
value = true
15+
# Nginx UI Template End
16+
17+
{{- if .blockUserAPI }}
18+
location ~* /wp-json/wp/v2/users {
19+
return 444;
20+
}
21+
{{- end }}
22+
23+
{{- if .blockXMLRPC }}
24+
location = /xmlrpc.php {
25+
return 444;
26+
}
27+
{{- end }}
28+
29+
location ~* wp-admin/includes { return 444; }
30+
location ~* wp-includes/theme-compat { return 444; }
31+
32+
location /wp-includes/ {
33+
location ~ \.(gz|tar|bzip2|7z|php|php5|php7|log|error|py|pl|kid|love|cgi|shtml|phps|pht|jsp|asp|sh|bash)$ {
34+
access_log off;
35+
log_not_found off;
36+
return 444;
37+
}
38+
}
39+
40+
location /wp-content/uploads/ {
41+
location ~ \.(gz|tar|bzip2|7z|php|php5|php7|log|error|py|pl|kid|love|cgi|shtml|phps|pht|jsp|asp|sh|bash)$ {
42+
access_log off;
43+
log_not_found off;
44+
return 444;
45+
}
46+
}
47+
48+
location /wp-content/cache/ {
49+
location ~ \.(php|php5|php7|log|error|py|pl|kid|love|cgi|shtml|phps|pht|jsp|asp|sh|bash)$ {
50+
access_log off;
51+
log_not_found off;
52+
return 444;
53+
}
54+
}
55+
56+
location /wp-content/plugins/ {
57+
location ~ \.(htm|shtml|php|swf|phps|pht|log|error|py|pl|kid|love|cgi|jsp|asp|sh|bash)$ {
58+
access_log off;
59+
log_not_found off;
60+
return 444;
61+
}
62+
}
63+
64+
location /wp-content/plugins/onesignal-free-web-push-notifications/ {
65+
access_log off;
66+
log_not_found off;
67+
allow all;
68+
}
69+
70+
location /wp-content/updraft/ {
71+
access_log off;
72+
log_not_found off;
73+
return 444;
74+
}
75+
76+
location /wp-content/backups-dup-pro/ {
77+
access_log off;
78+
log_not_found off;
79+
return 444;
80+
}
81+
82+
location /wp-snapshots/ {
83+
access_log off;
84+
log_not_found off;
85+
return 444;
86+
}
87+
88+
location /wp-content/uploads/sucuri/ {
89+
access_log off;
90+
log_not_found off;
91+
return 444;
92+
}
93+
94+
location /wp-content/uploads/nginx-helper/ {
95+
access_log off;
96+
log_not_found off;
97+
return 444;
98+
}
99+
100+
location ~* ^/(?:wp-links-opml\.php|wp-config\.php|wp-config-sample\.php|readme\.html|license\.txt)$ {
101+
access_log off;
102+
log_not_found off;
103+
return 444;
104+
}

0 commit comments

Comments
 (0)