update wpsc template and fix multisite
* update wpsc template the same way than fastcgi_cache * fix wp multisite stacks
This commit is contained in:
2
install
2
install
@@ -131,8 +131,10 @@ wo_install_dep()
|
||||
apt-get -y install build-essential curl gzip dirmngr python3 python3-apt python3-setuptools python3-dev sqlite3 git tar software-properties-common pigz gnupg2 > /dev/null 2>&1
|
||||
fi
|
||||
}; then echo -ne ' Installing dependencies [OK]\r'
|
||||
echo -ne '\n'
|
||||
else
|
||||
echo -e " Installing dependencies [FAIL]"
|
||||
echo -ne '\n'
|
||||
fi
|
||||
locale-gen en &>> /dev/null
|
||||
|
||||
|
||||
@@ -335,8 +335,8 @@ def setupwordpress(self, data):
|
||||
+ "core config "
|
||||
+ "--dbname=\'{0}\' --dbprefix=\'{1}\' --dbhost=\'{2}\' "
|
||||
.format(data['wo_db_name'], wo_wp_prefix, data['wo_db_host'])
|
||||
+ "--dbuser=\'{0}\' --dbpass= "
|
||||
"--extra-php<<PHP \n {2} {3} {4}\nPHP\""
|
||||
+ "--dbuser=\'{0}\' --dbpass=\'{1}\' "
|
||||
"--extra-php<<PHP \n {2} {3} \nPHP\""
|
||||
.format(data['wo_db_user'], data['wo_db_pass'],
|
||||
"\ndefine(\'WPMU_ACCEL_REDIRECT\',"
|
||||
" true);",
|
||||
@@ -350,7 +350,7 @@ def setupwordpress(self, data):
|
||||
.format(data['wo_db_name'], wo_wp_prefix,
|
||||
data['wo_db_host'])
|
||||
+ "--dbuser=\'{0}\' --dbpass=\'{1}\' "
|
||||
"--extra-php<<PHP \n {2} {3} {4} {redissalt}\nPHP\""
|
||||
"--extra-php<<PHP \n {2} {3} {redissalt}\nPHP\""
|
||||
.format(data['wo_db_user'],
|
||||
data['wo_db_pass'],
|
||||
"\ndefine(\'WPMU_ACCEL_REDIRECT\',"
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
# NGINX CONFIGURATION FOR FASTCGI_CACHE EXCEPTION
|
||||
# DO NOT MODIFY, ALL CHANGES WILL BE LOST AFTER AN WordOps (wo) UPDATE
|
||||
|
||||
# do not cache xhtml request
|
||||
map $http_x_requested_with $http_request_no_cache {
|
||||
default 0;
|
||||
XMLHttpRequest 1;
|
||||
}
|
||||
|
||||
# do not cache requests on cookies
|
||||
map $http_cookie $cookie_no_cache {
|
||||
default 0;
|
||||
"~*wordpress_[a-f0-9]+" 1;
|
||||
@@ -16,6 +20,8 @@ map $http_cookie $cookie_no_cache {
|
||||
"~*wptouch_switch_toogle" 1;
|
||||
"~*comment_author_email_" 1;
|
||||
}
|
||||
|
||||
# do not cache the following uri
|
||||
map $request_uri $uri_no_cache {
|
||||
default 0;
|
||||
"~*/wp-admin/" 1;
|
||||
@@ -28,11 +34,22 @@ map $request_uri $uri_no_cache {
|
||||
"~*/wp-links-opml.php" 1;
|
||||
"~*/xmlrpc.php" 1;
|
||||
}
|
||||
|
||||
# do not cache requests with query strings
|
||||
map $is_args $query_no_cache {
|
||||
default 1;
|
||||
"" 0;
|
||||
}
|
||||
|
||||
# if all previous check are passed, $skip_cache = 0
|
||||
map $http_request_no_cache$cookie_no_cache$uri_no_cache$query_no_cache $skip_cache {
|
||||
default 1;
|
||||
0000 0;
|
||||
}
|
||||
|
||||
# map $skip_cache with $cache_uri for --wpsc stack
|
||||
map $skip_cache $cache_uri {
|
||||
default 'null cache';
|
||||
0 $request_uri;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
# FastCGI cache settings
|
||||
fastcgi_cache_path /var/run/nginx-cache levels=1:2 keys_zone=WORDPRESS:50m inactive=60m;
|
||||
fastcgi_cache_path /var/run/nginx-cache levels=1:2 keys_zone=WORDPRESS:50m inactive=60m max_size=256M;
|
||||
fastcgi_cache_key "$scheme$request_method$host$request_uri";
|
||||
fastcgi_cache_use_stale error timeout invalid_header updating http_500 http_503;
|
||||
fastcgi_cache_methods GET HEAD;
|
||||
fastcgi_cache_background_update on;
|
||||
fastcgi_cache_valid 200 301 302 404 1h;
|
||||
fastcgi_buffers 16 16k;
|
||||
fastcgi_buffer_size 32k;
|
||||
|
||||
@@ -1,21 +1,6 @@
|
||||
# WPSC NGINX CONFIGURATION
|
||||
# DO NOT MODIFY, ALL CHANGES WILL BE LOST AFTER AN WordOps (wo) UPDATE
|
||||
set $cache_uri $request_uri;
|
||||
# POST requests and URL with a query string should always go to php
|
||||
if ($request_method = POST) {
|
||||
set $cache_uri 'null cache';
|
||||
}
|
||||
if ($query_string != "") {
|
||||
set $cache_uri 'null cache';
|
||||
}
|
||||
# Don't cache URL containing the following segments
|
||||
if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|wp-.*\.php|index.php|/feed/|.*sitemap.*\.xml)") {
|
||||
set $cache_uri 'null cache';
|
||||
}
|
||||
# Don't use the cache for logged in users or recent commenter or customer with items in cart
|
||||
if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in|[a-z0-9]+_items_in_cart") {
|
||||
set $cache_uri 'null cache';
|
||||
}
|
||||
|
||||
# Use cached or actual file if they exists, Otherwise pass request to WordPress
|
||||
location / {
|
||||
# If we add index.php?$args its break WooCommerce like plugins
|
||||
|
||||
@@ -1,21 +1,6 @@
|
||||
# WPSC NGINX CONFIGURATION
|
||||
# DO NOT MODIFY, ALL CHANGES WILL BE LOST AFTER AN WordOps (wo) UPDATE
|
||||
set $cache_uri $request_uri;
|
||||
# POST requests and URL with a query string should always go to php
|
||||
if ($request_method = POST) {
|
||||
set $cache_uri 'null cache';
|
||||
}
|
||||
if ($query_string != "") {
|
||||
set $cache_uri 'null cache';
|
||||
}
|
||||
# Don't cache URL containing the following segments
|
||||
if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|wp-.*\.php|index.php|/feed/|.*sitemap.*\.xml)") {
|
||||
set $cache_uri 'null cache';
|
||||
}
|
||||
# Don't use the cache for logged in users or recent commenter or customer with items in cart
|
||||
if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in|[a-z0-9]+_items_in_cart") {
|
||||
set $cache_uri 'null cache';
|
||||
}
|
||||
|
||||
# Use cached or actual file if they exists, Otherwise pass request to WordPress
|
||||
location / {
|
||||
# If we add index.php?$args its break WooCommerce like plugins
|
||||
|
||||
Reference in New Issue
Block a user