Add Cache-Enabler support

This commit is contained in:
VirtuBox
2019-08-15 19:59:23 +02:00
parent cdb195bd03
commit 25c1d8a19b
9 changed files with 99 additions and 117 deletions

View File

@@ -87,6 +87,8 @@ wo site create example.com --wp # install wordpress without any
wo site create example.com --wp --php73 # install wordpress with PHP 7.3 without any page caching wo site create example.com --wp --php73 # install wordpress with PHP 7.3 without any page caching
wo site create example.com --wpfc # install wordpress + nginx fastcgi_cache wo site create example.com --wpfc # install wordpress + nginx fastcgi_cache
wo site create example.com --wpredis # install wordpress + nginx redis_cache wo site create example.com --wpredis # install wordpress + nginx redis_cache
wo site create example.com --wprocket # install wordpress with WP-Rocket plugin
wo site create example.com --wpce # install wordpress with Cache-enabler plugin
wo site create example.com --wpsc # install wordpress with wp-super-cache plugin wo site create example.com --wpsc # install wordpress with wp-super-cache plugin
``` ```
@@ -97,6 +99,8 @@ wo site create example.com --wpsubdir # install wpmu-subdirectory wit
wo site create example.com --wpsubdir --wpsc # install wpmu-subdirectory with wp-super-cache plugin wo site create example.com --wpsubdir --wpsc # install wpmu-subdirectory with wp-super-cache plugin
wo site create example.com --wpsubdir --wpfc # install wpmu-subdirectory + nginx fastcgi_cache wo site create example.com --wpsubdir --wpfc # install wpmu-subdirectory + nginx fastcgi_cache
wo site create example.com --wpsubdir --wpredis # install wpmu-subdirectory + nginx redis_cache wo site create example.com --wpsubdir --wpredis # install wpmu-subdirectory + nginx redis_cache
wo site create example.com --wpsubdir --wprocket # install wpmu-subdirectory + WP-Rocket plugin
wo site create example.com --wpsubdir --wpce # install wpmu-subdirectory + Cache-Enabler plugin
``` ```
### WordPress multisite with subdomain ### WordPress multisite with subdomain
@@ -106,6 +110,8 @@ wo site create example.com --wpsubdomain # install wpmu-subdomain wit
wo site create example.com --wpsubdomain --wpsc # install wpmu-subdomain with wp-super-cache plugin wo site create example.com --wpsubdomain --wpsc # install wpmu-subdomain with wp-super-cache plugin
wo site create example.com --wpsubdomain --wpfc # install wpmu-subdomain + nginx fastcgi_cache wo site create example.com --wpsubdomain --wpfc # install wpmu-subdomain + nginx fastcgi_cache
wo site create example.com --wpsubdomain --wpredis # install wpmu-subdomain + nginx redis_cache wo site create example.com --wpsubdomain --wpredis # install wpmu-subdomain + nginx redis_cache
wo site create example.com --wpsubdomain --wprocket # install wpmu-subdomain + WP-Rocket plugin
wo site create example.com --wpsubdomain --wpce # install wpmu-subdomain + Cache-Enabler plugin
``` ```
### Non-WordPress sites ### Non-WordPress sites

View File

@@ -336,6 +336,9 @@ class WOSiteCreateController(CementBaseController):
(['--wprocket'], (['--wprocket'],
dict(help="create WordPress single/multi site with WP-Rocket", dict(help="create WordPress single/multi site with WP-Rocket",
action='store_true')), action='store_true')),
(['--wpce'],
dict(help="create WordPress single/multi site with Cache-Enabler",
action='store_true')),
(['--wpredis'], (['--wpredis'],
dict(help="create WordPress single/multi site " dict(help="create WordPress single/multi site "
"with redis cache", "with redis cache",
@@ -426,7 +429,7 @@ class WOSiteCreateController(CementBaseController):
if stype == 'proxy': if stype == 'proxy':
data = dict(site_name=wo_domain, www_domain=wo_www_domain, data = dict(site_name=wo_domain, www_domain=wo_www_domain,
static=True, basic=False, php73=False, wp=False, static=True, basic=False, php73=False, wp=False,
wpfc=False, wpsc=False, wprocket=False, wpfc=False, wpsc=False, wprocket=False, wpce=False,
multisite=False, multisite=False,
wpsubdir=False, webroot=wo_site_webroot) wpsubdir=False, webroot=wo_site_webroot)
data['proxy'] = True data['proxy'] = True
@@ -437,7 +440,7 @@ class WOSiteCreateController(CementBaseController):
if self.app.pargs.php73: if self.app.pargs.php73:
data = dict(site_name=wo_domain, www_domain=wo_www_domain, data = dict(site_name=wo_domain, www_domain=wo_www_domain,
static=False, basic=False, php73=True, wp=False, static=False, basic=False, php73=True, wp=False,
wpfc=False, wpsc=False, wprocket=False, wpfc=False, wpsc=False, wprocket=False, wpce=False,
multisite=False, multisite=False,
wpsubdir=False, webroot=wo_site_webroot) wpsubdir=False, webroot=wo_site_webroot)
data['basic'] = True data['basic'] = True
@@ -445,7 +448,7 @@ class WOSiteCreateController(CementBaseController):
if stype in ['html', 'php']: if stype in ['html', 'php']:
data = dict(site_name=wo_domain, www_domain=wo_www_domain, data = dict(site_name=wo_domain, www_domain=wo_www_domain,
static=True, basic=False, php73=False, wp=False, static=True, basic=False, php73=False, wp=False,
wpfc=False, wpsc=False, wprocket=False, wpfc=False, wpsc=False, wprocket=False, wpce=False,
multisite=False, multisite=False,
wpsubdir=False, webroot=wo_site_webroot) wpsubdir=False, webroot=wo_site_webroot)
@@ -457,7 +460,7 @@ class WOSiteCreateController(CementBaseController):
data = dict(site_name=wo_domain, www_domain=wo_www_domain, data = dict(site_name=wo_domain, www_domain=wo_www_domain,
static=False, basic=True, wp=False, wpfc=False, static=False, basic=True, wp=False, wpfc=False,
wpsc=False, wpredis=False, wprocket=False, wpsc=False, wpredis=False, wprocket=False, wpce=False,
multisite=False, multisite=False,
wpsubdir=False, webroot=wo_site_webroot, wpsubdir=False, webroot=wo_site_webroot,
wo_db_name='', wo_db_user='', wo_db_pass='', wo_db_name='', wo_db_user='', wo_db_pass='',
@@ -487,6 +490,7 @@ class WOSiteCreateController(CementBaseController):
if ((not self.app.pargs.wpfc) and if ((not self.app.pargs.wpfc) and
(not self.app.pargs.wpsc) and (not self.app.pargs.wpsc) and
(not self.app.pargs.wprocket) and (not self.app.pargs.wprocket) and
(not self.app.pargs.wpce) and
(not self.app.pargs.wpredis)): (not self.app.pargs.wpredis)):
data['basic'] = True data['basic'] = True
@@ -496,7 +500,6 @@ class WOSiteCreateController(CementBaseController):
data['basic'] = False data['basic'] = False
self.app.pargs.wpredis = True self.app.pargs.wpredis = True
# Check rerequired packages are installed or not # Check rerequired packages are installed or not
wo_auth = site_package_check(self, stype) wo_auth = site_package_check(self, stype)
@@ -836,6 +839,8 @@ class WOSiteUpdateController(CementBaseController):
dict(help="update to wpsc cache", action='store_true')), dict(help="update to wpsc cache", action='store_true')),
(['--wprocket'], (['--wprocket'],
dict(help="update to WP-Rocket cache", action='store_true')), dict(help="update to WP-Rocket cache", action='store_true')),
(['--wpce'],
dict(help="update to Cache-Enabler cache", action='store_true')),
(['--wpredis'], (['--wpredis'],
dict(help="update to redis cache", action='store_true')), dict(help="update to redis cache", action='store_true')),
(['-le', '--letsencrypt'], (['-le', '--letsencrypt'],
@@ -879,7 +884,7 @@ class WOSiteUpdateController(CementBaseController):
if not (pargs.php or pargs.php73 or if not (pargs.php or pargs.php73 or
pargs.mysql or pargs.wp or pargs.wpsubdir or pargs.mysql or pargs.wp or pargs.wpsubdir or
pargs.wpsubdomain or pargs.wpfc or pargs.wpsc or pargs.wpsubdomain or pargs.wpfc or pargs.wpsc or
pargs.wprocket or pargs.wprocket or pargs.wpce or
pargs.wpredis or pargs.letsencrypt or pargs.hsts or pargs.wpredis or pargs.letsencrypt or pargs.hsts or
pargs.dns or pargs.force): pargs.dns or pargs.force):
Log.error(self, "Please provide options to update sites.") Log.error(self, "Please provide options to update sites.")
@@ -958,7 +963,7 @@ class WOSiteUpdateController(CementBaseController):
if (pargs.password and not (pargs.html or if (pargs.password and not (pargs.html or
pargs.php or pargs.php73 or pargs.mysql or pargs.php or pargs.php73 or pargs.mysql or
pargs.wp or pargs.wpfc or pargs.wpsc or pargs.wp or pargs.wpfc or pargs.wpsc or
pargs.wprocket or pargs.wprocket or pargs.wpce or
pargs.wpsubdir or pargs.wpsubdomain or pargs.wpsubdir or pargs.wpsubdomain or
pargs.hsts)): pargs.hsts)):
try: try:
@@ -971,7 +976,7 @@ class WOSiteUpdateController(CementBaseController):
if (pargs.hsts and not (pargs.html or if (pargs.hsts and not (pargs.html or
pargs.php or pargs.php73 or pargs.mysql or pargs.php or pargs.php73 or pargs.mysql or
pargs.wp or pargs.wpfc or pargs.wpsc or pargs.wp or pargs.wpfc or pargs.wpsc or
pargs.wprocket or pargs.wprocket or parge.wpce or
pargs.wpsubdir or pargs.wpsubdomain or pargs.wpsubdir or pargs.wpsubdomain or
pargs.password)): pargs.password)):
try: try:
@@ -1013,16 +1018,16 @@ class WOSiteUpdateController(CementBaseController):
if stype == 'php': if stype == 'php':
data = dict(site_name=wo_domain, www_domain=wo_www_domain, data = dict(site_name=wo_domain, www_domain=wo_www_domain,
static=False, basic=True, wp=False, wpfc=False, static=False, basic=True, wp=False, wpfc=False,
wpsc=False, wpredis=False, wprocket=False, multisite=False, wpsc=False, wpredis=False, wprocket=False, wpce=False,
wpsubdir=False, webroot=wo_site_webroot, multisite=False, wpsubdir=False, webroot=wo_site_webroot,
currsitetype=oldsitetype, currcachetype=oldcachetype) currsitetype=oldsitetype, currcachetype=oldcachetype)
elif stype in ['mysql', 'wp', 'wpsubdir', 'wpsubdomain']: elif stype in ['mysql', 'wp', 'wpsubdir', 'wpsubdomain']:
data = dict(site_name=wo_domain, www_domain=wo_www_domain, data = dict(site_name=wo_domain, www_domain=wo_www_domain,
static=False, basic=True, wp=False, wpfc=False, static=False, basic=True, wp=False, wpfc=False,
wpsc=False, wpredis=False, wprocket=False, multisite=False, wpsc=False, wpredis=False, wprocket=False, wpce=False,
wpsubdir=False, webroot=wo_site_webroot, multisite=False,wpsubdir=False, webroot=wo_site_webroot,
wo_db_name='', wo_db_user='', wo_db_pass='', wo_db_name='', wo_db_user='', wo_db_pass='',
wo_db_host='', wo_db_host='',
currsitetype=oldsitetype, currcachetype=oldcachetype) currsitetype=oldsitetype, currcachetype=oldcachetype)
@@ -1076,30 +1081,42 @@ class WOSiteUpdateController(CementBaseController):
data['wpsc'] = False data['wpsc'] = False
data['wpredis'] = False data['wpredis'] = False
data['wprocket'] = False data['wprocket'] = False
data['wpce'] = False
elif oldcachetype == 'wpfc': elif oldcachetype == 'wpfc':
data['basic'] = False data['basic'] = False
data['wpfc'] = True data['wpfc'] = True
data['wpsc'] = False data['wpsc'] = False
data['wpredis'] = False data['wpredis'] = False
data['wprocket'] = False data['wprocket'] = False
data['wpce'] = False
elif oldcachetype == 'wpsc': elif oldcachetype == 'wpsc':
data['basic'] = False data['basic'] = False
data['wpfc'] = False data['wpfc'] = False
data['wpsc'] = True data['wpsc'] = True
data['wpredis'] = False data['wpredis'] = False
data['wprocket'] = False data['wprocket'] = False
data['wpce'] = False
elif oldcachetype == 'wpredis': elif oldcachetype == 'wpredis':
data['basic'] = False data['basic'] = False
data['wpfc'] = False data['wpfc'] = False
data['wpsc'] = False data['wpsc'] = False
data['wpredis'] = True data['wpredis'] = True
data['wprocket'] = False data['wprocket'] = False
data['wpce'] = False
elif oldcachetype == 'wprocket': elif oldcachetype == 'wprocket':
data['basic'] = False data['basic'] = False
data['wpfc'] = False data['wpfc'] = False
data['wpsc'] = False data['wpsc'] = False
data['wpredis'] = False data['wpredis'] = False
data['wprocket'] = True data['wprocket'] = True
data['wpce'] = False
elif oldcachetype == 'wpce':
data['basic'] = False
data['wpfc'] = False
data['wpsc'] = False
data['wpredis'] = False
data['wprocket'] = False
data['wpce'] = True
if pargs.php73 == 'on': if pargs.php73 == 'on':
data['php73'] = True data['php73'] = True
@@ -1262,6 +1279,11 @@ class WOSiteUpdateController(CementBaseController):
data['basic'] = False data['basic'] = False
cache = 'wprocket' cache = 'wprocket'
if pargs.wpce and data['currcachetype'] != 'wpce':
data['wpce'] = True
data['basic'] = False
cache = 'wpce'
if (php73 is old_php73) and (stype == oldsitetype and if (php73 is old_php73) and (stype == oldsitetype and
cache == oldcachetype): cache == oldcachetype):
return 1 return 1
@@ -1502,7 +1524,7 @@ class WOSiteUpdateController(CementBaseController):
"and please try again") "and please try again")
return 1 return 1
if ((oldcachetype in ['wpsc', 'basic', 'wpredis', 'wprocket'] and if ((oldcachetype in ['wpsc', 'basic', 'wpredis', 'wprocket', 'wpce'] and
(data['wpfc'])) or (oldsitetype == 'wp' and (data['wpfc'])) or (oldsitetype == 'wp' and
data['multisite'] and data['wpfc'])): data['multisite'] and data['wpfc'])):
try: try:
@@ -1541,7 +1563,7 @@ class WOSiteUpdateController(CementBaseController):
"and please try again") "and please try again")
return 1 return 1
elif ((oldcachetype in ['wpsc', 'basic', 'wpfc', 'wprocket'] and elif ((oldcachetype in ['wpsc', 'basic', 'wpfc', 'wprocket', 'wpce'] and
(data['wpredis'])) or (oldsitetype == 'wp' and (data['wpredis'])) or (oldsitetype == 'wp' and
data['multisite'] and data['multisite'] and
data['wpredis'])): data['wpredis'])):
@@ -1659,6 +1681,16 @@ class WOSiteUpdateController(CementBaseController):
"`tail /var/log/wo/wordops.log` and please try again") "`tail /var/log/wo/wordops.log` and please try again")
return 1 return 1
if oldcachetype == 'wpce' and not data['wpce']:
try:
uninstallwp_plugin(self, 'cache-enabler', data)
except SiteError as e:
Log.debug(self, str(e))
Log.info(self, Log.FAIL + "Update site failed."
"Check the log for details: "
"`tail /var/log/wo/wordops.log` and please try again")
return 1
# Service Nginx Reload # Service Nginx Reload
if not WOService.reload_service(self, 'nginx'): if not WOService.reload_service(self, 'nginx'):
Log.error(self, "service nginx reload failed. " Log.error(self, "service nginx reload failed. "

View File

@@ -16,6 +16,7 @@ from wo.core.git import WOGit
from wo.core.logging import Log from wo.core.logging import Log
from wo.core.mysql import * from wo.core.mysql import *
from wo.core.services import WOService from wo.core.services import WOService
from wo.cli.plugins.stack_pref import pre_pref, post_pref
from wo.core.shellexec import CommandExecutionError, WOShellExec from wo.core.shellexec import CommandExecutionError, WOShellExec
from wo.core.sslutils import SSL from wo.core.sslutils import SSL
from wo.core.variables import WOVariables from wo.core.variables import WOVariables
@@ -584,6 +585,10 @@ def setupwordpress(self, data):
if data['wpredis']: if data['wpredis']:
installwp_plugin(self, 'redis-cache', data) installwp_plugin(self, 'redis-cache', data)
"""Install Cache-Enabler"""
if data['wpce']:
installwp_plugin(self, 'cache-enabler', data)
wp_creds = dict(wp_user=wo_wp_user, wp_pass=wo_wp_pass, wp_creds = dict(wp_user=wo_wp_user, wp_pass=wo_wp_pass,
wp_email=wo_wp_email) wp_email=wo_wp_email)
@@ -785,7 +790,7 @@ def site_package_check(self, stype):
Log.info(self, "NGINX PLUS Detected ...") Log.info(self, "NGINX PLUS Detected ...")
apt = ["nginx-plus"] + WOVariables.wo_nginx apt = ["nginx-plus"] + WOVariables.wo_nginx
# apt_packages = apt_packages + WOVariables.wo_nginx # apt_packages = apt_packages + WOVariables.wo_nginx
stack.post_pref(apt, packages) stack.post_pref(self, apt, packages)
elif WOAptGet.is_installed(self, 'nginx'): elif WOAptGet.is_installed(self, 'nginx'):
Log.info(self, "WordOps detected a previously" Log.info(self, "WordOps detected a previously"
"installed Nginx package. " "installed Nginx package. "
@@ -794,7 +799,7 @@ def site_package_check(self, stype):
"https://github.com/WordOps/WordOps/issues/ \n") "https://github.com/WordOps/WordOps/issues/ \n")
apt = ["nginx"] + WOVariables.wo_nginx apt = ["nginx"] + WOVariables.wo_nginx
# apt_packages = apt_packages + WOVariables.wo_nginx # apt_packages = apt_packages + WOVariables.wo_nginx
stack.post_pref(apt, packages) post_pref(self, apt, packages)
else: else:
apt_packages = apt_packages + WOVariables.wo_nginx apt_packages = apt_packages + WOVariables.wo_nginx
else: else:
@@ -853,39 +858,6 @@ def site_package_check(self, stype):
if not WOAptGet.is_installed(self, 'redis-server'): if not WOAptGet.is_installed(self, 'redis-server'):
apt_packages = apt_packages + WOVariables.wo_redis apt_packages = apt_packages + WOVariables.wo_redis
if (os.path.isfile("/etc/nginx/nginx.conf") and
not os.path.isfile("/etc/nginx/common/redis-php72.conf")):
data = dict(upstream="php72")
Log.debug(self, 'Writting the nginx configuration to '
'file /etc/nginx/common/redis-php72.conf')
wo_nginx = open('/etc/nginx/common/redis-php72.conf',
encoding='utf-8', mode='w')
self.app.render((data), 'redis.mustache',
out=wo_nginx)
wo_nginx.close()
if os.path.isfile("/etc/nginx/conf.d/upstream.conf"):
if not WOFileUtils.grep(self, "/etc/nginx/conf.d/"
"upstream.conf",
"redis"):
with open("/etc/nginx/conf.d/upstream.conf",
"a") as redis_file:
redis_file.write("upstream redis {\n"
" server 127.0.0.1:6379;\n"
" keepalive 10;\n}")
if (os.path.isfile("/etc/nginx/nginx.conf") and
not os.path.isfile("/etc/nginx/conf.d/redis.conf")):
with open("/etc/nginx/conf.d/redis.conf", "a") as redis_file:
redis_file.write("# Log format Settings\n"
"log_format rt_cache_redis '$remote_addr"
" $upstream_response_time "
"$srcache_fetch_status [$time_local] '\n"
"'$http_host \"$request\" $status"
" $body_bytes_sent '\n"
"'\"$http_referer\" \"$http_user_agent\"';\n")
if self.app.pargs.php73: if self.app.pargs.php73:
Log.debug(self, "Setting apt_packages variable for PHP 7.3") Log.debug(self, "Setting apt_packages variable for PHP 7.3")
if not WOAptGet.is_installed(self, 'php7.3-fpm'): if not WOAptGet.is_installed(self, 'php7.3-fpm'):
@@ -895,72 +867,9 @@ def site_package_check(self, stype):
else: else:
apt_packages = apt_packages + WOVariables.wo_php73 apt_packages = apt_packages + WOVariables.wo_php73
if (os.path.isdir("/etc/nginx/common") and
not os.path.isfile("/etc/nginx/common/locations-wo.conf")):
data = dict(upstream="php73")
Log.debug(self, 'Writting the nginx configuration to '
'file /etc/nginx/common/locations-wo.conf')
wo_nginx = open('/etc/nginx/common/locations-wo.conf',
encoding='utf-8', mode='w')
self.app.render((data), 'locations.mustache',
out=wo_nginx)
wo_nginx.close()
Log.debug(self, 'Writting the nginx configuration to '
'file /etc/nginx/common/php73.conf')
wo_nginx = open('/etc/nginx/common/php73.conf',
encoding='utf-8', mode='w')
self.app.render((data), 'php.mustache',
out=wo_nginx)
wo_nginx.close()
Log.debug(self, 'Writting the nginx configuration to '
'file /etc/nginx/common/wpcommon-php73.conf')
wo_nginx = open('/etc/nginx/common/wpcommon-php73.conf',
encoding='utf-8', mode='w')
self.app.render((data), 'wpcommon.mustache',
out=wo_nginx)
wo_nginx.close()
Log.debug(self, 'Writting the nginx configuration to '
'file /etc/nginx/common/wpfc-php73.conf')
wo_nginx = open('/etc/nginx/common/wpfc-php73.conf',
encoding='utf-8', mode='w')
self.app.render((data), 'wpfc.mustache',
out=wo_nginx)
wo_nginx.close()
Log.debug(self, 'Writting the nginx configuration to '
'file /etc/nginx/common/wpsc-php73.conf')
wo_nginx = open('/etc/nginx/common/wpsc-php73.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 '
'file /etc/nginx/common/wprocket-php73.conf')
wo_nginx = open('/etc/nginx/common/wprocket-php73.conf',
encoding='utf-8', mode='w')
self.app.render((data), 'wprocket.mustache',
out=wo_nginx)
wo_nginx.close()
if (os.path.isfile("/etc/nginx/nginx.conf") and
not os.path.isfile("/etc/nginx/common/redis-php73.conf")):
data = dict(upstream="php73")
Log.debug(self, 'Writting the nginx configuration to '
'file /etc/nginx/common/redis-php73.conf')
wo_nginx = open('/etc/nginx/common/redis-php73.conf',
encoding='utf-8', mode='w')
self.app.render((data), 'redis.mustache',
out=wo_nginx)
wo_nginx.close()
return(stack.install(apt_packages=apt_packages, packages=packages, return(stack.install(apt_packages=apt_packages, packages=packages,
disp_msg=False)) disp_msg=False))
def updatewpuserpassword(self, wo_domain, wo_site_webroot): def updatewpuserpassword(self, wo_domain, wo_site_webroot):
wo_wp_user = '' wo_wp_user = ''
@@ -1098,7 +1007,7 @@ def detSitePar(opts):
if val and key in ['html', 'php', 'mysql', 'wp', if val and key in ['html', 'php', 'mysql', 'wp',
'wpsubdir', 'wpsubdomain', 'php73']: 'wpsubdir', 'wpsubdomain', 'php73']:
typelist.append(key) typelist.append(key)
elif val and key in ['wpfc', 'wpsc', 'wpredis', 'wprocket']: elif val and key in ['wpfc', 'wpsc', 'wpredis', 'wprocket', 'wpce']:
cachelist.append(key) cachelist.append(key)
if len(typelist) > 1 or len(cachelist) > 1: if len(typelist) > 1 or len(cachelist) > 1:

View File

@@ -334,6 +334,14 @@ def post_pref(self, apt_packages, packages):
out=wo_nginx) out=wo_nginx)
wo_nginx.close() wo_nginx.close()
Log.debug(self, 'Writting the nginx configuration to '
'file /etc/nginx/common/wpce-php72.conf')
wo_nginx = open('/etc/nginx/common/wpce-php72.conf',
encoding='utf-8', mode='w')
self.app.render((data), 'wpce.mustache',
out=wo_nginx)
wo_nginx.close()
# PHP 7.3 conf # PHP 7.3 conf
if os.path.isdir("/etc/nginx/common"): if os.path.isdir("/etc/nginx/common"):
data = dict(upstream="php73") data = dict(upstream="php73")
@@ -378,6 +386,14 @@ def post_pref(self, apt_packages, packages):
out=wo_nginx) out=wo_nginx)
wo_nginx.close() wo_nginx.close()
Log.debug(self, 'Writting the nginx configuration to '
'file /etc/nginx/common/wpce-php73.conf')
wo_nginx = open('/etc/nginx/common/wpce-php73.conf',
encoding='utf-8', mode='w')
self.app.render((data), 'wpce.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/redis-php73.conf') 'file /etc/nginx/common/redis-php73.conf')
wo_nginx = open('/etc/nginx/common/redis-php73.conf', wo_nginx = open('/etc/nginx/common/redis-php73.conf',

View File

@@ -64,7 +64,7 @@ map $http_request_no_cache$cookie_no_cache$uri_no_cache$query_no_cache $skip_cac
0000 0; 0000 0;
} }
# map $skip_cache with $cache_uri for --wpsc stack # map $skip_cache with $cache_uri for --wpsc --wpce & --wprocket stack
map $skip_cache $cache_uri { map $skip_cache $cache_uri {
0 $request_uri; 0 $request_uri;
default 'null cache'; default 'null cache';

View File

@@ -49,7 +49,7 @@ server {
} }
{{/static}} {{/static}}
{{^static}}include {{#basic}}common/php73.conf;{{/basic}}{{#wpfc}}common/wpfc-php73.conf;{{/wpfc}} {{#wpsc}}common/wpsc-php73.conf;{{/wpsc}}{{#wpredis}}common/redis-php73.conf;{{/wpredis}}{{#wprocket}}common/wprocket-php73.conf;{{/wprocket}} {{^static}}include {{#basic}}common/php73.conf;{{/basic}}{{#wpfc}}common/wpfc-php73.conf;{{/wpfc}} {{#wpsc}}common/wpsc-php73.conf;{{/wpsc}}{{#wpredis}}common/redis-php73.conf;{{/wpredis}}{{#wprocket}}common/wprocket-php73.conf;{{/wprocket}}{{#wpce}}common/wpce-php73.conf;{{/wpce}}
{{#wpsubdir}}include common/wpsubdir.conf;{{/wpsubdir}}{{/static}} {{#wpsubdir}}include common/wpsubdir.conf;{{/wpsubdir}}{{/static}}
{{#wp}}include common/wpcommon-php73.conf;{{/wp}} {{#wp}}include common/wpcommon-php73.conf;{{/wp}}
include common/locations-wo.conf;{{/proxy}} include common/locations-wo.conf;{{/proxy}}

View File

@@ -49,7 +49,7 @@ server {
} }
{{/static}} {{/static}}
{{^static}}include {{#basic}}common/php72.conf;{{/basic}}{{#wpfc}}common/wpfc-php72.conf;{{/wpfc}}{{#wpsc}}common/wpsc-php72.conf;{{/wpsc}}{{#wpredis}}common/redis-php72.conf;{{/wpredis}}{{#wprocket}}common/wprocket-php72.conf;{{/wprocket}} {{^static}}include {{#basic}}common/php72.conf;{{/basic}}{{#wpfc}}common/wpfc-php72.conf;{{/wpfc}}{{#wpsc}}common/wpsc-php72.conf;{{/wpsc}}{{#wpredis}}common/redis-php72.conf;{{/wpredis}}{{#wprocket}}common/wprocket-php72.conf;{{/wprocket}}{{#wpce}}common/wpce-php72.conf;{{/wpce}}
{{#wpsubdir}}include common/wpsubdir.conf;{{/wpsubdir}}{{/static}} {{#wpsubdir}}include common/wpsubdir.conf;{{/wpsubdir}}{{/static}}
{{#wp}}include common/wpcommon-php72.conf;{{/wp}} {{#wp}}include common/wpcommon-php72.conf;{{/wp}}
include common/locations-wo.conf;{{/proxy}} include common/locations-wo.conf;{{/proxy}}

View File

@@ -0,0 +1,19 @@
# WPCE NGINX CONFIGURATION - WO v3.9.7
# DO NOT MODIFY, ALL CHANGES WILL BE LOST AFTER AN WordOps (wo) UPDATE
# $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
location / {
try_files /wp-content/cache/cache-enabler/${http_host}${cache_uri}index.html $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_pass {{upstream}};
}
location ~* /cache/cache-enabler/\.html$ {
etag on;
add_header Vary "Accept-Encoding, Cookie";
access_log off;
log_not_found off;
expires 10h;
}

View File

@@ -1,4 +1,4 @@
# WPSC NGINX CONFIGURATION - WO v3.9.7 # WPROCKET NGINX CONFIGURATION - WO v3.9.7
# 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
# $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