6
6
# ---------------------------------------------------------------------------- #
7
7
8
8
# FastCGI Cache Path
9
- ####################
9
+ #####################
10
10
fastcgi_cache_path /var/cache/nginx levels=1:2 keys_zone=NPP:100m max_size=400m inactive=30d;
11
- ####################
11
+ #####################
12
12
13
13
server {
14
14
# Listen HTTP
15
- ##################################
15
+ #################
16
16
listen 80;
17
17
server_name localhost;
18
18
19
19
# HTTPS Redirect
20
- ##################################
20
+ #################
21
21
location / {
22
22
rewrite ^ https://$host$request_uri? permanent;
23
23
}
24
24
}
25
25
26
26
server {
27
27
# Listen HTTPS
28
- ##################################
28
+ #################
29
29
listen 443 ssl;
30
+ http2 on;
30
31
server_name localhost;
31
32
32
- # Document root
33
- ###############
33
+ # phpMyAdmin Reverse Proxy
34
+ #################
35
+ location = /phpmyadmin {
36
+ return 301 $scheme://$host/phpmyadmin/;
37
+ }
38
+
39
+ location ~ \/phpmyadmin {
40
+ rewrite ^/phpmyadmin(/.*)$ $1 break;
41
+ proxy_set_header Host $host;
42
+ proxy_set_header X-Forwarded-Scheme $scheme;
43
+ proxy_set_header X-Forwarded-Proto $scheme;
44
+ proxy_set_header X-Forwarded-For $remote_addr;
45
+ proxy_set_header X-Real-IP $remote_addr;
46
+ proxy_pass http://phpmyadmin:80;
47
+ }
48
+ # End
49
+ #####
50
+
51
+ # WP Document root
52
+ #################
34
53
root /var/www/html;
35
54
index index.php index.html index.htm;
36
55
37
- # Cache Settings
56
+ # FCGI Cache Settings
38
57
#################
39
58
set $skip_cache 0;
40
59
@@ -61,7 +80,7 @@ server {
61
80
#####
62
81
63
82
# Stop Nginx from logging
64
- #########################
83
+ #################
65
84
location = /favicon.ico {
66
85
log_not_found off;
67
86
access_log off;
@@ -75,16 +94,16 @@ server {
75
94
# End
76
95
#####
77
96
78
- # Serve content
79
- ##################
97
+ # Serve WP content
98
+ #################
80
99
location / {
81
100
try_files $uri $uri/ /index.php$is_args$args;
82
101
}
83
102
# End
84
103
#####
85
104
86
- # PHP-FPM Configuration
87
- ################
105
+ # WP PHP-FPM PASS
106
+ #################
88
107
location ~ \.php$ {
89
108
# Use NPP "Cache Key Regex" option for non-default structers
90
109
# This structer supported in default by NPP
@@ -107,47 +126,47 @@ server {
107
126
# End
108
127
#####
109
128
110
- # WP Security Settings
111
- #######################
129
+ # WP Security Settings (Enable on Production)
130
+ #################
112
131
# Deny access to hidden files and directories (except .well-known)
113
- location ~ /\.(?!well-known/) {
114
- deny all;
115
- }
132
+ # location ~ /\.(?!well-known/) {
133
+ # deny all;
134
+ # }
116
135
117
136
# Deny access to wp-config files and other critical files
118
- location ~* ^/(?:wp-config\.php|wp-config-sample\.php|readme\.html|license\.txt)$ {
119
- deny all;
120
- }
137
+ # location ~* ^/(?:wp-config\.php|wp-config-sample\.php|readme\.html|license\.txt)$ {
138
+ # deny all;
139
+ # }
121
140
122
141
# Deny access to PHP files in uploads, files, plugins, themes
123
- location ~* /(?:uploads|files|wp-content|wp-includes)/.*\.php$ {
124
- deny all;
125
- }
142
+ # location ~* /(?:uploads|files|wp-content|wp-includes)/.*\.php$ {
143
+ # deny all;
144
+ # }
126
145
127
146
# Deny access to script file types
128
- location ~* .(pl|cgi|py|sh|lua|asp)$ {
129
- deny all;
130
- }
147
+ # location ~* .(pl|cgi|py|sh|lua|asp)$ {
148
+ # deny all;
149
+ # }
131
150
132
151
# Block access to wp-content plugin/theme log files
133
- location ~* ^/wp-content/(plugins|themes)/.*\.(txt|log|md)$ {
134
- deny all;
135
- }
152
+ # location ~* ^/wp-content/(plugins|themes)/.*\.(txt|log|md)$ {
153
+ # deny all;
154
+ # }
136
155
137
156
# Block common attack patterns
138
- location ~* "(eval\(.*\)|base64_encode\(.*\)|\{0\}|phpinfo|self/environ)" {
139
- deny all;
140
- }
157
+ # location ~* "(eval\(.*\)|base64_encode\(.*\)|\{0\}|phpinfo|self/environ)" {
158
+ # deny all;
159
+ # }
141
160
142
161
# Block dangerous file access
143
- location ~* "/(thumb|timthumb|config|settings|sqlpatch|webshell|phpinfo)\.php" {
144
- deny all;
145
- }
162
+ # location ~* "/(thumb|timthumb|config|settings|sqlpatch|webshell|phpinfo)\.php" {
163
+ # deny all;
164
+ # }
146
165
# End
147
166
#####
148
167
149
168
# Browser Cache (Enable on Production)
150
- ###############
169
+ #################
151
170
# location ~*.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|css|rss|atom|js|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
152
171
# expires max;
153
172
# log_not_found off;
@@ -165,7 +184,7 @@ server {
165
184
#####
166
185
167
186
# SSL Settings (Enable on Production)
168
- ##############
187
+ #################
169
188
# ssl_protocols TLSv1.2 TLSv1.3;
170
189
# ssl_prefer_server_ciphers on;
171
190
# ssl_ciphers ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS;
@@ -178,7 +197,7 @@ server {
178
197
#####
179
198
180
199
# Security Headers (Enable on Production)
181
- ##################
200
+ #################
182
201
# add_header Content-Security-Policy upgrade-insecure-requests;
183
202
# add_header Permissions-Policy "microphone=(), camera=(), interest-cohort=(), browsing-topics=()";
184
203
# add_header Referrer-Policy no-referrer-when-downgrade;
@@ -190,7 +209,7 @@ server {
190
209
#####
191
210
192
211
# FastCGI Cache Status Header
193
- #############################
212
+ #################
194
213
add_header NPP-FastCGI-Cache $upstream_cache_status;
195
- #############################
214
+ #################
196
215
}
0 commit comments