@codigodoleo/wp-kit 2.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -1
- package/server/php/php.ini +48 -0
- package/server/www/rocket.conf +283 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codigodoleo/wp-kit",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "Kit opinativo para padronizar projetos WordPress com CI/CD dinâmico.",
|
|
5
5
|
"main": "bin/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"lib/",
|
|
16
16
|
"modules/",
|
|
17
17
|
"templates/",
|
|
18
|
+
"server/",
|
|
18
19
|
".cspell.json",
|
|
19
20
|
".gitkeep"
|
|
20
21
|
],
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
[PHP]
|
|
2
|
+
|
|
3
|
+
;;;;;;;;;;;;;;;
|
|
4
|
+
; PHP Globals ;
|
|
5
|
+
;;;;;;;;;;;;;;;
|
|
6
|
+
|
|
7
|
+
short_open_tag = Off
|
|
8
|
+
output_buffering = 4096
|
|
9
|
+
allow_call_time_pass_reference = Off
|
|
10
|
+
request_order = "GP"
|
|
11
|
+
register_long_arrays = Off
|
|
12
|
+
register_argc_argv = Off
|
|
13
|
+
magic_quotes_gpc = Off
|
|
14
|
+
enable_dl = Off
|
|
15
|
+
allow_url_fopen = On
|
|
16
|
+
realpath_cache_size = "800K"
|
|
17
|
+
realpath_cache_ttl = "86400"
|
|
18
|
+
disable_functions =
|
|
19
|
+
sendmail_path=/bin/true
|
|
20
|
+
|
|
21
|
+
[Date]
|
|
22
|
+
date.timezone = "UTC"
|
|
23
|
+
|
|
24
|
+
;;;;;;;;;;;;;;;;;;;;;;
|
|
25
|
+
;; PACKAGE SETTINGS ;;
|
|
26
|
+
;;;;;;;;;;;;;;;;;;;;;;
|
|
27
|
+
|
|
28
|
+
[xdebug]
|
|
29
|
+
xdebug.mode=debug
|
|
30
|
+
xdebug.start_with_request=yes
|
|
31
|
+
xdebug.client_host=host.docker.internal
|
|
32
|
+
xdebug.client_port=9003
|
|
33
|
+
xdebug.log_level=0
|
|
34
|
+
xdebug.idekey=VSCODE
|
|
35
|
+
|
|
36
|
+
; Globals
|
|
37
|
+
expose_php = on
|
|
38
|
+
max_execution_time = 90
|
|
39
|
+
max_input_time = 900
|
|
40
|
+
max_input_vars = 10000
|
|
41
|
+
memory_limit = 512M
|
|
42
|
+
upload_max_filesize = 100M
|
|
43
|
+
post_max_size = 100M
|
|
44
|
+
error_reporting = E_ALL & ~E_DEPRECATED
|
|
45
|
+
ignore_repeated_errors = on
|
|
46
|
+
html_errors = off
|
|
47
|
+
display_errors = on
|
|
48
|
+
log_errors = on
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
###################################################################################################
|
|
2
|
+
# Rocket-Nginx
|
|
3
|
+
#
|
|
4
|
+
# Rocket-Nginx is a NGINX configuration to speedup your WordPress
|
|
5
|
+
# website with the cache plugin WP-Rocket (http://wp-rocket.me)
|
|
6
|
+
#
|
|
7
|
+
# Author: Maxime Jobin
|
|
8
|
+
# Maintainer: SatelliteWP.com
|
|
9
|
+
# URL: https://github.com/satellitewp/rocket-nginx
|
|
10
|
+
#
|
|
11
|
+
# Tested with WP-Rocket version: 3.16.2.1
|
|
12
|
+
# Tested with NGINX: 1.26.1 (mainline)
|
|
13
|
+
#
|
|
14
|
+
# Version 3.1.0
|
|
15
|
+
#
|
|
16
|
+
###################################################################################################
|
|
17
|
+
|
|
18
|
+
# Add debug information into header
|
|
19
|
+
set $rocket_debug 1;
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
###################################################################################################
|
|
23
|
+
# Do not alter theses values
|
|
24
|
+
#
|
|
25
|
+
set $rocket_bypass 1; # Should NGINX bypass WordPress and call cache file directly ?
|
|
26
|
+
set $rocket_encryption ""; # Is GZIP accepted by client ?
|
|
27
|
+
set $rocket_file ""; # Filename to look for
|
|
28
|
+
set $rocket_is_bypassed "MISS"; # Header text added to check if the bypass worked or not. Header: X-Rocket-Nginx-Serving-Static
|
|
29
|
+
set $rocket_reason ""; # Reason why cache file was not used. If cache file is used, what file was used
|
|
30
|
+
set $rocket_https_prefix ""; # HTTPS prefix to use when cached files are using HTTPS
|
|
31
|
+
set $rocket_mobile_prefix ""; # Mobile prefix to use when mobile device is detected and mobile cache is activated
|
|
32
|
+
set $rocket_is_https 0; # Checks if the request is HTTPS
|
|
33
|
+
set $rocket_dynamic ""; # Dynamic value to add to cached filename
|
|
34
|
+
set $rocket_device "desktop"; # Device type (desktop or mobile)
|
|
35
|
+
|
|
36
|
+
###################################################################################################
|
|
37
|
+
# PAGE CACHE
|
|
38
|
+
#
|
|
39
|
+
|
|
40
|
+
# Define Rocket-Nginx $is_args
|
|
41
|
+
set $rocket_is_args $is_args;
|
|
42
|
+
|
|
43
|
+
# Get query string without the parameters (before the '?')
|
|
44
|
+
set $rocket_uri_path $request_uri;
|
|
45
|
+
if ($request_uri ~* "^([^?]*)(\?.+)$") {
|
|
46
|
+
set $rocket_uri_path $1;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
# Is GZIP accepted by client ?
|
|
50
|
+
if ($http_accept_encoding ~ gzip) {
|
|
51
|
+
set $rocket_encryption "_gzip";
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
# Is Brotli accepted by client ?
|
|
55
|
+
if ($http_accept_encoding ~ br) {
|
|
56
|
+
set $rocket_encryption "";
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
# Is HTTPS request ?
|
|
60
|
+
if ($https = "on") { set $rocket_is_https 1; }
|
|
61
|
+
if ($http_x_forwarded_proto = "https") { set $rocket_is_https 1; }
|
|
62
|
+
if ($http_front_end_https = "on") { set $rocket_is_https 1; }
|
|
63
|
+
if ($http_x_forwarded_protocol = "https") { set $rocket_is_https 1; }
|
|
64
|
+
if ($http_x_forwarded_ssl = "on") { set $rocket_is_https 1; }
|
|
65
|
+
if ($http_x_url_scheme = "https") { set $rocket_is_https 1; }
|
|
66
|
+
if ($http_forwarded ~ /proto=https/) { set $rocket_is_https 1; }
|
|
67
|
+
|
|
68
|
+
if ($rocket_is_https = "1") {
|
|
69
|
+
set $rocket_https_prefix "-https";
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
# Set mobile detection file path
|
|
73
|
+
# This variable contains a file to look for. If it exists, WP Rocket is set to
|
|
74
|
+
# generate both Desktop and Mobile cache.
|
|
75
|
+
set $rocket_mobile_detection "$document_root/wp-content/cache/wp-rocket/$http_host/$request_uri/.mobile-active";
|
|
76
|
+
|
|
77
|
+
# Query strings to ignore
|
|
78
|
+
set $rocket_args $args;
|
|
79
|
+
if ($rocket_args ~ (.*)(?:&|^)utm_source=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
80
|
+
if ($rocket_args ~ (.*)(?:&|^)utm_campaign=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
81
|
+
if ($rocket_args ~ (.*)(?:&|^)utm_medium=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
82
|
+
if ($rocket_args ~ (.*)(?:&|^)utm_expid=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
83
|
+
if ($rocket_args ~ (.*)(?:&|^)utm_term=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
84
|
+
if ($rocket_args ~ (.*)(?:&|^)utm_content=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
85
|
+
if ($rocket_args ~ (.*)(?:&|^)utm_id=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
86
|
+
if ($rocket_args ~ (.*)(?:&|^)utm_source_platform=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
87
|
+
if ($rocket_args ~ (.*)(?:&|^)utm_creative_format=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
88
|
+
if ($rocket_args ~ (.*)(?:&|^)utm_marketing_tactic=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
89
|
+
if ($rocket_args ~ (.*)(?:&|^)_ga=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
90
|
+
if ($rocket_args ~ (.*)(?:&|^)gclid=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
91
|
+
if ($rocket_args ~ (.*)(?:&|^)campaignid=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
92
|
+
if ($rocket_args ~ (.*)(?:&|^)adgroupid=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
93
|
+
if ($rocket_args ~ (.*)(?:&|^)adid=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
94
|
+
if ($rocket_args ~ (.*)(?:&|^)gbraid=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
95
|
+
if ($rocket_args ~ (.*)(?:&|^)wbraid=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
96
|
+
if ($rocket_args ~ (.*)(?:&|^)gclsrc=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
97
|
+
if ($rocket_args ~ (.*)(?:&|^)ef_id=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
98
|
+
if ($rocket_args ~ (.*)(?:&|^)fb_action_ids=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
99
|
+
if ($rocket_args ~ (.*)(?:&|^)fb_action_types=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
100
|
+
if ($rocket_args ~ (.*)(?:&|^)fb_source=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
101
|
+
if ($rocket_args ~ (.*)(?:&|^)fbclid=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
102
|
+
if ($rocket_args ~ (.*)(?:&|^)mc_cid=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
103
|
+
if ($rocket_args ~ (.*)(?:&|^)mc_eid=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
104
|
+
if ($rocket_args ~ (.*)(?:&|^)mtm_source=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
105
|
+
if ($rocket_args ~ (.*)(?:&|^)mtm_medium=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
106
|
+
if ($rocket_args ~ (.*)(?:&|^)mtm_campaign=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
107
|
+
if ($rocket_args ~ (.*)(?:&|^)mtm_keyword=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
108
|
+
if ($rocket_args ~ (.*)(?:&|^)mtm_cid=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
109
|
+
if ($rocket_args ~ (.*)(?:&|^)mtm_content=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
110
|
+
if ($rocket_args ~ (.*)(?:&|^)_ke=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
111
|
+
if ($rocket_args ~ (.*)(?:&|^)age-verified=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
112
|
+
if ($rocket_args ~ (.*)(?:&|^)ao_noptimize=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
113
|
+
if ($rocket_args ~ (.*)(?:&|^)usqp=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
114
|
+
if ($rocket_args ~ (.*)(?:&|^)cn-reloaded=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
115
|
+
if ($rocket_args ~ (.*)(?:&|^)sscid=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
116
|
+
if ($rocket_args ~ (.*)(?:&|^)msclkid=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
117
|
+
|
|
118
|
+
# Remove & at the beginning (if needed)
|
|
119
|
+
if ($rocket_args ~ ^&(.*)) { set $rocket_args $1; }
|
|
120
|
+
|
|
121
|
+
# Do not count arguments if part of caching arguments
|
|
122
|
+
if ($rocket_args ~ ^\?$) {
|
|
123
|
+
set $rocket_is_args "";
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
# Adjust $rocket_is_args after processing query strings to ignore
|
|
127
|
+
if ($rocket_args = "") {
|
|
128
|
+
set $rocket_is_args "";
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
# Query string to cache
|
|
132
|
+
# None
|
|
133
|
+
|
|
134
|
+
# Check if device is Mobile
|
|
135
|
+
if ($http_user_agent ~* "(?:phone|windows\s+phone|ipod|blackberry|(?:android|bb\d+|meego|silk|googlebot) .+? mobile|palm|windows\s+ce|opera mini|avantgo|mobilesafari|docomo|kaios)") {
|
|
136
|
+
set $rocket_device "mobile";
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
# Set mobile prefix if mobile mode is activated
|
|
140
|
+
if (-f "$rocket_mobile_detection") {
|
|
141
|
+
set $rocket_mobile_prefix "-mobile";
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
if ($rocket_device != "mobile") {
|
|
145
|
+
set $rocket_mobile_prefix "";
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
# File/URL to return IF we must bypass WordPress
|
|
149
|
+
# Desktop: index.html
|
|
150
|
+
# Gzip: index.html_gzip
|
|
151
|
+
# HTTPS: index-https.html
|
|
152
|
+
# Mobile: index-mobile-https.html
|
|
153
|
+
set $rocket_file_start "index$rocket_mobile_prefix$rocket_https_prefix";
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
set $rocket_pre_url "/wp-content/cache/wp-rocket/$http_host/$rocket_uri_path/$rocket_args/";
|
|
157
|
+
set $rocket_pre_file "$document_root/wp-content/cache/wp-rocket/$http_host/$rocket_uri_path/$rocket_args/";
|
|
158
|
+
|
|
159
|
+
# Standard cache file format
|
|
160
|
+
set $rocket_url "$rocket_pre_url$rocket_file_start$rocket_dynamic.html";
|
|
161
|
+
set $rocket_file "$rocket_pre_file$rocket_file_start$rocket_dynamic.html";
|
|
162
|
+
|
|
163
|
+
# Check if gzip version cached file is available
|
|
164
|
+
if (-f "$rocket_file$rocket_encryption") {
|
|
165
|
+
set $rocket_file "$rocket_file$rocket_encryption";
|
|
166
|
+
set $rocket_url "$rocket_url$rocket_encryption";
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
# Do not bypass if the cached file does not exist
|
|
170
|
+
if (!-f "$rocket_file") {
|
|
171
|
+
set $rocket_bypass 0;
|
|
172
|
+
set $rocket_is_bypassed "MISS";
|
|
173
|
+
set $rocket_reason "File not cached";
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
# Do not bypass if it's a POST request
|
|
177
|
+
if ($request_method = POST) {
|
|
178
|
+
set $rocket_bypass 0;
|
|
179
|
+
set $rocket_is_bypassed "BYPASS";
|
|
180
|
+
set $rocket_reason "POST request";
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
# Do not bypass if arguments are found (e.g. ?page=2)
|
|
184
|
+
if ($rocket_is_args) {
|
|
185
|
+
set $rocket_bypass 0;
|
|
186
|
+
set $rocket_is_bypassed "BYPASS";
|
|
187
|
+
set $rocket_reason "Arguments found";
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
# Do not bypass if the site is in maintenance mode
|
|
191
|
+
if (-f "$document_root/.maintenance") {
|
|
192
|
+
set $rocket_bypass 0;
|
|
193
|
+
set $rocket_is_bypassed "BYPASS";
|
|
194
|
+
set $rocket_reason "Maintenance mode";
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
# Do not bypass if one of those cookie if found
|
|
198
|
+
# wordpress_logged_in_[hash] : When a user is logged in, this cookie is created (we'd rather let WP-Rocket handle that)
|
|
199
|
+
# wp-postpass_[hash] : When a protected post requires a password, this cookie is created.
|
|
200
|
+
if ($http_cookie ~* "(wordpress_logged_in_|wp\-postpass_|woocommerce_items_in_cart|woocommerce_cart_hash|wptouch_switch_toogle|comment_author_|comment_author_email_)") {
|
|
201
|
+
set $rocket_bypass 0;
|
|
202
|
+
set $rocket_is_bypassed "BYPASS";
|
|
203
|
+
set $rocket_reason "Cookie";
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
# If the bypass token is still on, let's bypass WordPress with the cached URL
|
|
207
|
+
if ($rocket_bypass = 1) {
|
|
208
|
+
set $rocket_is_bypassed "HIT";
|
|
209
|
+
set $rocket_reason "$rocket_url";
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
# Clear variables if debug is not needed
|
|
213
|
+
if ($rocket_debug = 0) {
|
|
214
|
+
set $rocket_reason "";
|
|
215
|
+
set $rocket_file "";
|
|
216
|
+
set $rocket_device "";
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
# If the bypass token is still on, rewrite according to the file linked to the request
|
|
220
|
+
if ($rocket_bypass = 1) {
|
|
221
|
+
rewrite .* "$rocket_url" last;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
# Add header to HTML cached files
|
|
225
|
+
location ~ /wp-content/cache/wp-rocket/.*html$ {
|
|
226
|
+
etag on;
|
|
227
|
+
add_header Vary "Accept-Encoding, Cookie";
|
|
228
|
+
add_header Cache-Control "no-cache, no-store, must-revalidate";
|
|
229
|
+
add_header X-Rocket-Nginx-Serving-Static $rocket_is_bypassed;
|
|
230
|
+
add_header X-Rocket-Nginx-Reason $rocket_reason;
|
|
231
|
+
add_header X-Rocket-Nginx-File $rocket_file;
|
|
232
|
+
add_header X-Rocket-Nginx-Device $rocket_device;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
# Do not gzip cached files that are already gzipped
|
|
236
|
+
location ~ /wp-content/cache/wp-rocket/.*_gzip$ {
|
|
237
|
+
etag on;
|
|
238
|
+
gzip off;
|
|
239
|
+
types {}
|
|
240
|
+
default_type text/html;
|
|
241
|
+
add_header Content-Encoding gzip;
|
|
242
|
+
add_header Vary "Accept-Encoding, Cookie";
|
|
243
|
+
add_header Cache-Control "no-cache, no-store, must-revalidate";
|
|
244
|
+
add_header X-Rocket-Nginx-Serving-Static $rocket_is_bypassed;
|
|
245
|
+
add_header X-Rocket-Nginx-Reason $rocket_reason;
|
|
246
|
+
add_header X-Rocket-Nginx-File $rocket_file;
|
|
247
|
+
add_header X-Rocket-Nginx-Device $rocket_device;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
# Debug header (when file is not cached)
|
|
251
|
+
add_header X-Rocket-Nginx-Serving-Static $rocket_is_bypassed;
|
|
252
|
+
add_header X-Rocket-Nginx-Reason $rocket_reason;
|
|
253
|
+
add_header X-Rocket-Nginx-File $rocket_file;
|
|
254
|
+
add_header X-Rocket-Nginx-Device $rocket_device;
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
###################################################################################################
|
|
258
|
+
# BROWSER CSS CACHE
|
|
259
|
+
#
|
|
260
|
+
location ~* \.css$ {
|
|
261
|
+
etag on;
|
|
262
|
+
gzip_vary on;
|
|
263
|
+
expires 30d;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
###################################################################################################
|
|
268
|
+
# BROWSER JS CACHE
|
|
269
|
+
#
|
|
270
|
+
location ~* \.js$ {
|
|
271
|
+
etag on;
|
|
272
|
+
gzip_vary on;
|
|
273
|
+
expires 30d;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
###################################################################################################
|
|
278
|
+
# BROWSER MEDIA CACHE
|
|
279
|
+
#
|
|
280
|
+
location ~* \.(ico|gif|jpe?g|png|svg|eot|otf|woff|woff2|ttf|ogg|webp)$ {
|
|
281
|
+
etag on;
|
|
282
|
+
expires 30d;
|
|
283
|
+
}
|