66# ---------------------------------------------------------------------------- #
77
88# FastCGI Cache Path
9- ####################
9+ #####################
1010fastcgi_cache_path /var/cache/nginx levels=1:2 keys_zone=NPP:100m max_size=400m inactive=30d;
11- ####################
11+ #####################
1212
1313server {
1414 # Listen HTTP
15- ##################################
15+ #################
1616 listen 80;
1717 server_name localhost;
1818
1919 # HTTPS Redirect
20- ##################################
20+ #################
2121 location / {
2222 rewrite ^ https://$host$request_uri? permanent;
2323 }
2424}
2525
2626server {
2727 # Listen HTTPS
28- ##################################
28+ #################
2929 listen 443 ssl;
30+ http2 on;
3031 server_name localhost;
3132
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+ #################
3453 root /var/www/html;
3554 index index.php index.html index.htm;
3655
37- # Cache Settings
56+ # FCGI Cache Settings
3857 #################
3958 set $skip_cache 0;
4059
@@ -61,7 +80,7 @@ server {
6180 #####
6281
6382 # Stop Nginx from logging
64- #########################
83+ #################
6584 location = /favicon.ico {
6685 log_not_found off;
6786 access_log off;
@@ -75,16 +94,16 @@ server {
7594 # End
7695 #####
7796
78- # Serve content
79- ##################
97+ # Serve WP content
98+ #################
8099 location / {
81100 try_files $uri $uri/ /index.php$is_args$args;
82101 }
83102 # End
84103 #####
85104
86- # PHP-FPM Configuration
87- ################
105+ # WP PHP-FPM PASS
106+ #################
88107 location ~ \.php$ {
89108 # Use NPP "Cache Key Regex" option for non-default structers
90109 # This structer supported in default by NPP
@@ -107,47 +126,47 @@ server {
107126 # End
108127 #####
109128
110- # WP Security Settings
111- #######################
129+ # WP Security Settings (Enable on Production)
130+ #################
112131 # 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+ # }
116135
117136 # 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+ # }
121140
122141 # 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+ # }
126145
127146 # 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+ # }
131150
132151 # 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+ # }
136155
137156 # 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+ # }
141160
142161 # 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+ # }
146165 # End
147166 #####
148167
149168 # Browser Cache (Enable on Production)
150- ###############
169+ #################
151170 # 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)$ {
152171 # expires max;
153172 # log_not_found off;
@@ -165,7 +184,7 @@ server {
165184 #####
166185
167186 # SSL Settings (Enable on Production)
168- ##############
187+ #################
169188 # ssl_protocols TLSv1.2 TLSv1.3;
170189 # ssl_prefer_server_ciphers on;
171190 # 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 {
178197 #####
179198
180199 # Security Headers (Enable on Production)
181- ##################
200+ #################
182201 # add_header Content-Security-Policy upgrade-insecure-requests;
183202 # add_header Permissions-Policy "microphone=(), camera=(), interest-cohort=(), browsing-topics=()";
184203 # add_header Referrer-Policy no-referrer-when-downgrade;
@@ -190,7 +209,7 @@ server {
190209 #####
191210
192211 # FastCGI Cache Status Header
193- #############################
212+ #################
194213 add_header NPP-FastCGI-Cache $upstream_cache_status;
195- #############################
214+ #################
196215}
0 commit comments