Update wpce & wprocket template
This commit is contained in:
@@ -208,12 +208,10 @@ def post_pref(self, apt_packages, packages):
|
|||||||
'{0}/cloudflare.conf'.format(ngxcnf),
|
'{0}/cloudflare.conf'.format(ngxcnf),
|
||||||
'cloudflare.mustache', data)
|
'cloudflare.mustache', data)
|
||||||
|
|
||||||
wo_nginx = open('{0}/'
|
WOTemplate.tmpl_render(self,
|
||||||
'map-wp-fastcgi-cache.conf'.format(ngxcnf),
|
'{0}/map-wp-fastcgi-cache.conf'.format(
|
||||||
encoding='utf-8', mode='w')
|
ngxcnf),
|
||||||
self.app.render((data), 'map-wp.mustache',
|
'map-wp.mustache', data)
|
||||||
out=wo_nginx)
|
|
||||||
wo_nginx.close()
|
|
||||||
|
|
||||||
# Setup Nginx common directory
|
# Setup Nginx common directory
|
||||||
if not os.path.exists('{0}'.format(ngxcom)):
|
if not os.path.exists('{0}'.format(ngxcom)):
|
||||||
@@ -225,62 +223,40 @@ def post_pref(self, apt_packages, packages):
|
|||||||
data = dict()
|
data = dict()
|
||||||
|
|
||||||
# Common Configuration
|
# Common Configuration
|
||||||
Log.debug(self, 'Writting the nginx configuration to '
|
WOTemplate.tmpl_render(self,
|
||||||
'file /etc/nginx/common/locations-wo.conf')
|
'{0}/locations-wo.conf'
|
||||||
wo_nginx = open('/etc/nginx/common/locations-wo.conf',
|
.format(ngxcom),
|
||||||
encoding='utf-8', mode='w')
|
'locations.mustache', data)
|
||||||
self.app.render((data), 'locations.mustache',
|
|
||||||
out=wo_nginx)
|
|
||||||
wo_nginx.close()
|
|
||||||
|
|
||||||
Log.debug(self, 'Writting the nginx configuration to '
|
WOTemplate.tmpl_render(self,
|
||||||
'file /etc/nginx/common/wpsubdir.conf')
|
'{0}/wpsubdir.conf'
|
||||||
wo_nginx = open('/etc/nginx/common/wpsubdir.conf',
|
.format(ngxcom),
|
||||||
encoding='utf-8', mode='w')
|
'wpsubdir.mustache', data)
|
||||||
self.app.render((data), 'wpsubdir.mustache',
|
|
||||||
out=wo_nginx)
|
|
||||||
wo_nginx.close()
|
|
||||||
data = dict(upstream="php72")
|
data = dict(upstream="php72")
|
||||||
# PHP 7.2 conf
|
# PHP 7.2 conf
|
||||||
Log.debug(self, 'Writting the nginx configuration to '
|
WOTemplate.tmpl_render(self,
|
||||||
'file /etc/nginx/common/php72.conf')
|
'{0}/php72.conf'
|
||||||
wo_nginx = open('/etc/nginx/common/php72.conf',
|
.format(ngxcom),
|
||||||
encoding='utf-8', mode='w')
|
'php72.mustache', data)
|
||||||
self.app.render((data), 'php.mustache',
|
|
||||||
out=wo_nginx)
|
|
||||||
wo_nginx.close()
|
|
||||||
|
|
||||||
Log.debug(self, 'Writting the nginx configuration to '
|
WOTemplate.tmpl_render(self,
|
||||||
'file /etc/nginx/common/redis-php72.conf')
|
'{0}/redis-php72.conf'
|
||||||
wo_nginx = open('/etc/nginx/common/redis-php72.conf',
|
.format(ngxcom),
|
||||||
encoding='utf-8', mode='w')
|
'redis.mustache', data)
|
||||||
self.app.render((data), 'redis.mustache',
|
|
||||||
out=wo_nginx)
|
|
||||||
wo_nginx.close()
|
|
||||||
|
|
||||||
Log.debug(self, 'Writting the nginx configuration to '
|
WOTemplate.tmpl_render(self,
|
||||||
'file /etc/nginx/common/wpcommon-php72.conf')
|
'{0}/wpcommon-php72.conf'
|
||||||
wo_nginx = open('/etc/nginx/common/wpcommon-php72.conf',
|
.format(ngxcom),
|
||||||
encoding='utf-8', mode='w')
|
'wpcommon.mustache', data)
|
||||||
self.app.render((data), 'wpcommon.mustache',
|
|
||||||
out=wo_nginx)
|
|
||||||
wo_nginx.close()
|
|
||||||
|
|
||||||
Log.debug(self, 'Writting the nginx configuration to '
|
WOTemplate.tmpl_render(self,
|
||||||
'file /etc/nginx/common/wpfc-php72.conf')
|
'{0}/wpfc-php72.conf'
|
||||||
wo_nginx = open('/etc/nginx/common/wpfc-php72.conf',
|
.format(ngxcom),
|
||||||
encoding='utf-8', mode='w')
|
'wpfc.mustache', data)
|
||||||
self.app.render((data), 'wpfc.mustache',
|
WOTemplate.tmpl_render(self,
|
||||||
out=wo_nginx)
|
'{0}/wpsc-php72.conf'
|
||||||
wo_nginx.close()
|
.format(ngxcom),
|
||||||
|
'wpsc.mustache', data)
|
||||||
Log.debug(self, 'Writting the nginx configuration to '
|
|
||||||
'file /etc/nginx/common/wpsc-php72.conf')
|
|
||||||
wo_nginx = open('/etc/nginx/common/wpsc-php72.conf',
|
|
||||||
encoding='utf-8', mode='w')
|
|
||||||
self.app.render((data), 'wpsc.mustache',
|
|
||||||
out=wo_nginx)
|
|
||||||
wo_nginx.close()
|
|
||||||
|
|
||||||
Log.debug(self, 'Writting the nginx configuration to '
|
Log.debug(self, 'Writting the nginx configuration to '
|
||||||
'file /etc/nginx/common/wprocket-php72.conf')
|
'file /etc/nginx/common/wprocket-php72.conf')
|
||||||
|
|||||||
@@ -54,6 +54,12 @@ map $request_uri $uri_no_cache {
|
|||||||
"~*/resetpass/" 1;
|
"~*/resetpass/" 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
map $http_user_agent $mobile_prefix {
|
||||||
|
default "";
|
||||||
|
"~*iphone" -mobile;
|
||||||
|
"~*android" -mobile;
|
||||||
|
}
|
||||||
|
|
||||||
# do not cache requests with query strings
|
# do not cache requests with query strings
|
||||||
map $is_args $query_no_cache {
|
map $is_args $query_no_cache {
|
||||||
default 1;
|
default 1;
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ location ~ \.php$ {
|
|||||||
include fastcgi_params;
|
include fastcgi_params;
|
||||||
fastcgi_pass {{upstream}};
|
fastcgi_pass {{upstream}};
|
||||||
}
|
}
|
||||||
location ~* /cache/cache-enabler/\.html$ {
|
location ~ /wp-content/cache/cache-enabler/.*html$ {
|
||||||
etag on;
|
etag on;
|
||||||
add_header Vary "Accept-Encoding, Cookie";
|
add_header Vary "Accept-Encoding, Cookie";
|
||||||
access_log off;
|
access_log off;
|
||||||
|
|||||||
@@ -3,14 +3,14 @@
|
|||||||
# $cache_uri variable set in /etc/nginx/conf.d/map-wp.conf
|
# $cache_uri variable set in /etc/nginx/conf.d/map-wp.conf
|
||||||
# Use cached or actual file if they exists, Otherwise pass request to WordPress
|
# Use cached or actual file if they exists, Otherwise pass request to WordPress
|
||||||
location / {
|
location / {
|
||||||
try_files /wp-content/cache/wp-rocket/$http_host/$cache_uri/index$https_prefix.html $uri $uri/ /index.php$is_args$args;
|
try_files /wp-content/cache/wp-rocket/$http_host/$cache_uri/index${mobile_prefix}${https_prefix}.html /wp-content/cache/wp-rocket/$http_host/$cache_uri/index${https_prefix}.html $uri $uri/ /index.php$is_args$args;
|
||||||
}
|
}
|
||||||
location ~ \.php$ {
|
location ~ \.php$ {
|
||||||
try_files $uri =404;
|
try_files $uri =404;
|
||||||
include fastcgi_params;
|
include fastcgi_params;
|
||||||
fastcgi_pass {{upstream}};
|
fastcgi_pass {{upstream}};
|
||||||
}
|
}
|
||||||
location ~* /cache/wp-rocket/\.html$ {
|
location ~ /wp-content/cache/wp-rocket/.*html$ {
|
||||||
etag on;
|
etag on;
|
||||||
add_header Vary "Accept-Encoding, Cookie";
|
add_header Vary "Accept-Encoding, Cookie";
|
||||||
access_log off;
|
access_log off;
|
||||||
|
|||||||
Reference in New Issue
Block a user