Address issue #319 - again, not standardlize yet for the release
This commit is contained in:
@@ -221,8 +221,11 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
|||||||
'stub_status.mustache', data)
|
'stub_status.mustache', data)
|
||||||
data = dict(release=WOVar.wo_version)
|
data = dict(release=WOVar.wo_version)
|
||||||
WOTemplate.deploy(
|
WOTemplate.deploy(
|
||||||
self, '{0}/image_suffix.conf'.format(ngxcnf),
|
self, '{0}/webp.conf'.format(ngxcnf),
|
||||||
'image_suffix.mustache', data, overwrite=False)
|
'webp.mustache', data, overwrite=False)
|
||||||
|
WOTemplate.deploy(
|
||||||
|
self, '{0}/avif.conf'.format(ngxcnf),
|
||||||
|
'avif.mustache', data, overwrite=False)
|
||||||
|
|
||||||
WOTemplate.deploy(
|
WOTemplate.deploy(
|
||||||
self, '{0}/cloudflare.conf'.format(ngxcnf),
|
self, '{0}/cloudflare.conf'.format(ngxcnf),
|
||||||
|
|||||||
39
wo/cli/templates/avif.mustache
Normal file
39
wo/cli/templates/avif.mustache
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
# avif NGINX CONFIGURATION - WordOps {{release}}
|
||||||
|
# DO NOT MODIFY, ALL CHANGES WILL BE LOST AFTER AN WordOps (wo) UPDATE
|
||||||
|
|
||||||
|
map $http_accept $avif_suffix_valid {
|
||||||
|
default 1;
|
||||||
|
"~*avif" 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
map $realip_remote_addr $avif_suffix_cf {
|
||||||
|
default 0;
|
||||||
|
103.21.244.0/22 1;
|
||||||
|
103.22.200.0/22 1;
|
||||||
|
103.31.4.0/22 1;
|
||||||
|
104.16.0.0/12 1;
|
||||||
|
108.162.192.0/18 1;
|
||||||
|
131.0.72.0/22 1;
|
||||||
|
141.101.64.0/18 1;
|
||||||
|
162.158.0.0/15 1;
|
||||||
|
172.64.0.0/13 1;
|
||||||
|
173.245.48.0/20 1;
|
||||||
|
188.114.96.0/20 1;
|
||||||
|
190.93.240.0/20 1;
|
||||||
|
197.234.240.0/22 1;
|
||||||
|
198.41.128.0/17 1;
|
||||||
|
199.27.128.0/21 1;
|
||||||
|
2400:cb00::/32 1;
|
||||||
|
2405:8100::/32 1;
|
||||||
|
2405:b500::/32 1;
|
||||||
|
2606:4700::/32 1;
|
||||||
|
2803:f800::/32 1;
|
||||||
|
2a06:98c0::/29 1;
|
||||||
|
2c0f:f248::/32 1;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
map $avif_suffix_cf$avif_suffix_valid $avif_suffix {
|
||||||
|
default ".notexists";
|
||||||
|
00 ".avif";
|
||||||
|
}
|
||||||
@@ -1,13 +1,12 @@
|
|||||||
# Image suffix NGINX CONFIGURATION - WordOps {{release}}
|
# WEBP NGINX CONFIGURATION - WordOps {{release}}
|
||||||
# DO NOT MODIFY, ALL CHANGES WILL BE LOST AFTER AN WordOps (wo) UPDATE
|
# DO NOT MODIFY, ALL CHANGES WILL BE LOST AFTER AN WordOps (wo) UPDATE
|
||||||
|
|
||||||
map $http_accept $image_suffix_valid {
|
map $http_accept $webp_suffix_valid {
|
||||||
default 1;
|
default 1;
|
||||||
"~*avif" 2;
|
"~*webp" 0;
|
||||||
"~*webp" 3;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
map $realip_remote_addr $image_suffix_cf {
|
map $realip_remote_addr $webp_suffix_cf {
|
||||||
default 0;
|
default 0;
|
||||||
103.21.244.0/22 1;
|
103.21.244.0/22 1;
|
||||||
103.22.200.0/22 1;
|
103.22.200.0/22 1;
|
||||||
@@ -34,8 +33,7 @@ map $realip_remote_addr $image_suffix_cf {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
map $image_suffix_cf$image_suffix_valid $image_suffix {
|
map $webp_suffix_cf$webp_suffix_valid $webp_suffix {
|
||||||
default "";
|
default "";
|
||||||
02 ".avif";
|
00 ".webp";
|
||||||
03 ".webp";
|
|
||||||
}
|
}
|
||||||
@@ -45,7 +45,7 @@ location /wp-content/uploads {
|
|||||||
access_log off;
|
access_log off;
|
||||||
log_not_found off;
|
log_not_found off;
|
||||||
expires max;
|
expires max;
|
||||||
try_files $uri$image_suffix $uri =404;
|
try_files $uri$avif_suffix $uri$webp_suffix $uri =404;
|
||||||
}
|
}
|
||||||
location ~* \.(php|gz|log|zip|tar|rar|xz)$ {
|
location ~* \.(php|gz|log|zip|tar|rar|xz)$ {
|
||||||
#Prevent Direct Access Of PHP Files & Backups from Web Browsers
|
#Prevent Direct Access Of PHP Files & Backups from Web Browsers
|
||||||
@@ -61,7 +61,7 @@ location /wp-content/plugins/ewww-image-optimizer/images {
|
|||||||
access_log off;
|
access_log off;
|
||||||
log_not_found off;
|
log_not_found off;
|
||||||
expires max;
|
expires max;
|
||||||
try_files $uri$image_suffix $uri =404;
|
try_files $uri$avif_suffix $uri$webp_suffix $uri =404;
|
||||||
}
|
}
|
||||||
location ~ \.php$ {
|
location ~ \.php$ {
|
||||||
#Prevent Direct Access Of PHP Files From Web Browsers
|
#Prevent Direct Access Of PHP Files From Web Browsers
|
||||||
|
|||||||
Reference in New Issue
Block a user