feat: convert WordOps from Nginx to OpenLiteSpeed + LSPHP + LSCache
Some checks failed
CI / test WordOps (ubuntu-22.04) (push) Has been cancelled
CI / test WordOps (ubuntu-24.04) (push) Has been cancelled

Complete conversion of the WordOps stack from Nginx + PHP-FPM to
OpenLiteSpeed + LSPHP + LSCache. This is a full rewrite across all 7
phases of the codebase:

- Foundation: OLS paths, variables, services, removed pynginxconfig dep
- Templates: 11 new OLS mustache templates, removed nginx-specific ones
- Stack: stack_pref, stack, stack_services, stack_upgrade, stack_migrate
- Site: site_functions, site, site_create, site_update
- Plugins: debug, info, log, clean rewritten for OLS
- SSL/ACME: acme.sh deploy uses lswsctrl, OLS vhssl blocks
- Other: secure, backup, clone, install script

Additional features:
- Debian 13 (trixie) support
- PHP 8.5 support
- WP Fort Knox mu-plugin integration (wo secure --lockdown/--unlock)
- --nginx CLI flag preserved for backward compatibility

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-08 18:55:16 +01:00
parent aa127070e1
commit fa5bf17eb8
42 changed files with 2328 additions and 2926 deletions

View File

@@ -37,17 +37,17 @@ class SiteError(Exception):
def pre_run_checks(self):
# Check nginx configuration
# Check OpenLiteSpeed configuration
Log.wait(self, "Running pre-run checks")
try:
Log.debug(self, "checking NGINX configuration ...")
Log.debug(self, "checking OpenLiteSpeed configuration ...")
fnull = open('/dev/null', 'w')
subprocess.check_call(["/usr/sbin/nginx", "-t"], stdout=fnull,
subprocess.check_call([WOVar.wo_ols_bin, "-t"], stdout=fnull,
stderr=subprocess.STDOUT)
except CalledProcessError as e:
Log.failed(self, "Running pre-update checks")
Log.debug(self, "{0}".format(str(e)))
raise SiteError("nginx configuration check failed.")
raise SiteError("OpenLiteSpeed configuration check failed.")
else:
Log.valide(self, "Running pre-update checks")
@@ -58,55 +58,133 @@ def check_domain_exists(self, domain):
return False
def setupdomain(self, data):
def addOLSVhost(self, domain, webroot):
"""Add virtualHost block and listener maps to httpd_config.conf"""
httpd_conf = '{0}/httpd_config.conf'.format(WOVar.wo_ols_conf_dir)
# for debug purpose
# for key, value in data.items() :
# print (key, value)
vhost_block = (
'\nvirtualHost {domain} {{\n'
' vhRoot {webroot}\n'
' configFile {vhost_dir}/{domain}/vhconf.conf\n'
' allowSymbolLink 1\n'
' enableScript 1\n'
' restrained 0\n'
'}}\n'
).format(domain=domain, webroot=webroot,
vhost_dir=WOVar.wo_ols_vhost_dir)
with open(httpd_conf, 'a') as f:
f.write(vhost_block)
addOLSListenerMap(self, domain)
def addOLSListenerMap(self, domain):
"""Add map entries for domain to listener blocks in httpd_config.conf"""
httpd_conf = '{0}/httpd_config.conf'.format(WOVar.wo_ols_conf_dir)
map_line = ' map {0} {0}\n'.format(domain)
with open(httpd_conf, 'r') as f:
lines = f.readlines()
new_lines = []
in_listener = False
for line in lines:
if line.strip().startswith('listener '):
in_listener = True
if in_listener and line.strip() == '}':
# Check if map for this domain already exists
if not any(domain in l and 'map' in l for l in new_lines):
new_lines.append(map_line)
in_listener = False
new_lines.append(line)
with open(httpd_conf, 'w') as f:
f.writelines(new_lines)
def removeOLSListenerMap(self, domain):
"""Remove map entries for domain from listener blocks"""
httpd_conf = '{0}/httpd_config.conf'.format(WOVar.wo_ols_conf_dir)
with open(httpd_conf, 'r') as f:
lines = f.readlines()
with open(httpd_conf, 'w') as f:
for line in lines:
if 'map' in line and domain in line:
continue
f.write(line)
def removeOLSVhost(self, domain):
"""Remove virtualHost block and listener maps from httpd_config.conf"""
httpd_conf = '{0}/httpd_config.conf'.format(WOVar.wo_ols_conf_dir)
removeOLSListenerMap(self, domain)
# Remove virtualHost block
with open(httpd_conf, 'r') as f:
lines = f.readlines()
in_vhost_block = False
new_lines = []
for line in lines:
if line.strip().startswith('virtualHost') and domain in line:
in_vhost_block = True
continue
if in_vhost_block:
if line.strip() == '}':
in_vhost_block = False
continue
else:
new_lines.append(line)
with open(httpd_conf, 'w') as f:
f.writelines(new_lines)
def setupdomain(self, data):
wo_domain_name = data['site_name']
wo_site_webroot = data['webroot']
# Check if nginx configuration already exists
# if os.path.isfile('/etc/nginx/sites-available/{0}'
# .format(wo_domain_name)):
# raise SiteError("nginx configuration already exists for site")
Log.info(self, "Setting up NGINX configuration \t", end='')
# write nginx config for file
Log.info(self, "Setting up OpenLiteSpeed configuration \t", end='')
# Create OLS vhost directory and write vhconf.conf
try:
wo_site_nginx_conf = open('/etc/nginx/sites-available/{0}'
.format(wo_domain_name), encoding='utf-8',
mode='w')
self.app.render((data), 'virtualconf.mustache',
out=wo_site_nginx_conf)
wo_site_nginx_conf.close()
vhost_dir = '{0}/{1}'.format(WOVar.wo_ols_vhost_dir, wo_domain_name)
if not os.path.exists(vhost_dir):
os.makedirs(vhost_dir)
wo_site_ols_conf = open('{0}/vhconf.conf'.format(vhost_dir),
encoding='utf-8', mode='w')
self.app.render((data), 'ols-vhost.mustache',
out=wo_site_ols_conf)
wo_site_ols_conf.close()
except IOError as e:
Log.debug(self, str(e))
raise SiteError("create nginx configuration failed for site")
raise SiteError("create OpenLiteSpeed configuration failed for site")
except Exception as e:
Log.debug(self, str(e))
raise SiteError("create nginx configuration failed for site")
raise SiteError("create OpenLiteSpeed configuration failed for site")
finally:
# Check nginx -t and return status over it
# Check OLS config and return status
try:
Log.debug(self, "Checking generated nginx conf, please wait...")
Log.debug(self, "Checking generated OLS conf, please wait...")
fnull = open('/dev/null', 'w')
subprocess.check_call(["/usr/sbin/nginx", "-t"], stdout=fnull,
subprocess.check_call([WOVar.wo_ols_bin, "-t"], stdout=fnull,
stderr=subprocess.STDOUT)
Log.info(self, "[" + Log.ENDC + "Done" + Log.OKBLUE + "]")
except CalledProcessError as e:
Log.debug(self, "{0}".format(str(e)))
Log.info(self, "[" + Log.ENDC + Log.FAIL + "Fail" +
Log.OKBLUE + "]")
raise SiteError("created nginx configuration failed for site."
" check with `nginx -t`")
raise SiteError("created OpenLiteSpeed configuration failed "
"for site. check with `{0} -t`"
.format(WOVar.wo_ols_bin))
# create symbolic link for
WOFileUtils.create_symlink(self, ['/etc/nginx/sites-available/{0}'
.format(wo_domain_name),
'/etc/nginx/sites-enabled/{0}'
.format(wo_domain_name)])
# Add virtualHost mapping to httpd_config.conf
addOLSVhost(self, wo_domain_name, wo_site_webroot)
# Creating htdocs & logs directory
Log.info(self, "Setting up webroot \t\t", end='')
@@ -115,22 +193,10 @@ def setupdomain(self, data):
os.makedirs('{0}/htdocs'.format(wo_site_webroot))
if not os.path.exists('{0}/logs'.format(wo_site_webroot)):
os.makedirs('{0}/logs'.format(wo_site_webroot))
if not os.path.exists('{0}/conf/nginx'.format(wo_site_webroot)):
os.makedirs('{0}/conf/nginx'.format(wo_site_webroot))
WOFileUtils.create_symlink(self, ['/var/log/nginx/{0}.access.log'
.format(wo_domain_name),
'{0}/logs/access.log'
.format(wo_site_webroot)])
WOFileUtils.create_symlink(self, ['/var/log/nginx/{0}.error.log'
.format(wo_domain_name),
'{0}/logs/error.log'
.format(wo_site_webroot)])
except Exception as e:
Log.debug(self, str(e))
raise SiteError("setup webroot failed for site")
finally:
# TODO Check if directories are setup
if (os.path.exists('{0}/htdocs'.format(wo_site_webroot)) and
os.path.exists('{0}/logs'.format(wo_site_webroot))):
Log.info(self, "[" + Log.ENDC + "Done" + Log.OKBLUE + "]")
@@ -526,60 +592,8 @@ def setupwordpress(self, data, vhostonly=False):
Log.debug(self, str(e))
raise SiteError("Update wordpress permalinks failed")
"""Install nginx-helper plugin """
installwp_plugin(self, 'nginx-helper', data)
if data['wpfc']:
plugin_data_object = {"log_level": "INFO",
"log_filesize": 5,
"enable_purge": 1,
"enable_map": "0",
"enable_log": 0,
"enable_stamp": 1,
"purge_homepage_on_new": 1,
"purge_homepage_on_edit": 1,
"purge_homepage_on_del": 1,
"purge_archive_on_new": 1,
"purge_archive_on_edit": 1,
"purge_archive_on_del": 1,
"purge_archive_on_new_comment": 0,
"purge_archive_on_deleted_comment": 0,
"purge_page_on_mod": 1,
"purge_page_on_new_comment": 1,
"purge_page_on_deleted_comment": 1,
"cache_method": "enable_fastcgi",
"purge_method": "get_request",
"redis_hostname": "127.0.0.1",
"redis_port": "6379",
"redis_prefix": "nginx-cache:"}
plugin_data = json.dumps(plugin_data_object)
setupwp_plugin(self, "nginx-helper",
"rt_wp_nginx_helper_options", plugin_data, data)
elif data['wpredis']:
plugin_data_object = {"log_level": "INFO",
"log_filesize": 5,
"enable_purge": 1,
"enable_map": "0",
"enable_log": 0,
"enable_stamp": 1,
"purge_homepage_on_new": 1,
"purge_homepage_on_edit": 1,
"purge_homepage_on_del": 1,
"purge_archive_on_new": 1,
"purge_archive_on_edit": 1,
"purge_archive_on_del": 1,
"purge_archive_on_new_comment": 0,
"purge_archive_on_deleted_comment": 0,
"purge_page_on_mod": 1,
"purge_page_on_new_comment": 1,
"purge_page_on_deleted_comment": 1,
"cache_method": "enable_redis",
"purge_method": "get_request",
"redis_hostname": "127.0.0.1",
"redis_port": "6379",
"redis_prefix": "nginx-cache:"}
plugin_data = json.dumps(plugin_data_object)
setupwp_plugin(self, 'nginx-helper',
'rt_wp_nginx_helper_options', plugin_data, data)
"""Install LiteSpeed Cache plugin (built-in caching for OLS)"""
installwp_plugin(self, 'litespeed-cache', data)
"""Install Wp Super Cache"""
if data['wpsc']:
@@ -771,11 +785,14 @@ def sitebackup(self, data):
if not WOFileUtils.isexist(self, backup_path):
WOFileUtils.mkdir(self, backup_path)
Log.info(self, "Backup location : {0}".format(backup_path))
WOFileUtils.copyfile(self, '/etc/nginx/sites-available/{0}'
.format(data['site_name']), backup_path)
vhost_conf = '{0}/{1}/vhconf.conf'.format(
WOVar.wo_ols_vhost_dir, data['site_name'])
if os.path.isfile(vhost_conf):
WOFileUtils.copyfile(self, vhost_conf, backup_path)
if data['currsitetype'] in ['html', 'php', 'php72', 'php74',
'php73', 'php80', 'php81', 'php82', 'php83', 'php84'
'php73', 'php80', 'php81', 'php82',
'php83', 'php84', 'php85',
'proxy', 'mysql']:
if not data['wp']:
Log.info(self, "Backing up Webroot \t\t", end='')
@@ -836,70 +853,47 @@ def site_package_check(self, stype):
stack.app = self.app
pargs = self.app.pargs
if stype in ['html', 'proxy', 'php', 'mysql', 'wp', 'wpsubdir',
'wpsubdomain', 'php74', 'php80', 'php81', 'php82', 'php83', 'php84', 'alias', 'subsite']:
Log.debug(self, "Setting apt_packages variable for Nginx")
'wpsubdomain', 'php74', 'php80', 'php81', 'php82',
'php83', 'php84', 'php85', 'alias', 'subsite']:
Log.debug(self, "Setting apt_packages variable for OpenLiteSpeed")
# Check if server has nginx-custom package
if not (WOAptGet.is_installed(self, 'nginx-custom') or
WOAptGet.is_installed(self, 'nginx-mainline')):
# check if Server has nginx-plus installed
if WOAptGet.is_installed(self, 'nginx-plus'):
# do something
# do post nginx installation configuration
Log.info(self, "NGINX PLUS Detected ...")
apt = ["nginx-plus"] + WOVar.wo_nginx
# apt_packages = apt_packages + WOVar.wo_nginx
post_pref(self, apt, packages)
elif WOAptGet.is_installed(self, 'nginx'):
Log.info(self, "WordOps detected a previously"
"installed Nginx package. "
"It may or may not have required modules. "
"\nIf you need help, please create an issue at "
"https://github.com/WordOps/WordOps/issues/ \n")
apt = ["nginx"] + WOVar.wo_nginx
# apt_packages = apt_packages + WOVar.wo_nginx
post_pref(self, apt, packages)
elif os.path.isfile('/usr/sbin/nginx'):
post_pref(self, WOVar.wo_nginx, [])
# Check if server has OpenLiteSpeed installed
if not WOAptGet.is_installed(self, 'openlitespeed'):
if os.path.isfile('/usr/local/lsws/bin/openlitespeed'):
post_pref(self, WOVar.wo_ols, [])
else:
apt_packages = apt_packages + WOVar.wo_nginx
else:
# Fix for Nginx white screen death
if not WOFileUtils.grep(self, '/etc/nginx/fastcgi_params',
'SCRIPT_FILENAME'):
with open('/etc/nginx/fastcgi_params', encoding='utf-8',
mode='a') as wo_nginx:
wo_nginx.write('fastcgi_param \tSCRIPT_FILENAME '
'\t$request_filename;\n')
apt_packages = apt_packages + WOVar.wo_ols
php_versions = ['php74', 'php80', 'php81', 'php82', 'php83', 'php84']
php_versions = list(WOVar.wo_php_versions.keys())
selected_versions = [version for version in php_versions if getattr(pargs, version)]
selected_versions = [version for version in php_versions
if getattr(pargs, version, False)]
if len(selected_versions) > 1:
Log.error(self, "Error: two different PHP versions cannot be "
"combined within the same WordOps site")
if ((not pargs.php74) and (not pargs.php80) and
(not pargs.php81) and (not pargs.php82) and
(not pargs.php83) and (not pargs.php84) and
stype in ['php', 'mysql', 'wp', 'wpsubdir',
'wpsubdomain']):
Log.debug(self, "Setting apt_packages variable for PHP")
if (not any(getattr(pargs, v, False) for v in WOVar.wo_php_versions) and
stype in ['php', 'mysql', 'wp', 'wpsubdir',
'wpsubdomain']):
Log.debug(self, "Setting apt_packages variable for LSPHP")
for version_key, version_number in WOVar.wo_php_versions.items():
if (self.app.config.has_section('php') and
self.app.config.get('php', 'version') == version_number):
Log.debug(
self,
f"Setting apt_packages variable for PHP {version_number}")
if not WOAptGet.is_installed(self, f'php{version_number}-fpm'):
f"Setting apt_packages variable for LSPHP {version_number}")
short_ver = version_number.replace('.', '')
if not WOAptGet.is_installed(self, f'lsphp{short_ver}'):
apt_packages += getattr(
WOVar, f'wo_{version_key}') + WOVar.wo_php_extra
for version_key, version_number in WOVar.wo_php_versions.items():
if getattr(pargs, version_key) and stype in [version_key, 'mysql', 'wp', 'wpsubdir', 'wpsubdomain']:
Log.debug(self, f"Setting apt_packages variable for PHP {version_number}")
if not WOAptGet.is_installed(self, f'php{version_number}-fpm'):
if getattr(pargs, version_key, False) and stype in [
version_key, 'mysql', 'wp', 'wpsubdir', 'wpsubdomain']:
Log.debug(self, f"Setting apt_packages variable for LSPHP {version_number}")
short_ver = version_number.replace('.', '')
if not WOAptGet.is_installed(self, f'lsphp{short_ver}'):
apt_packages += getattr(WOVar, f'wo_{version_key}') + WOVar.wo_php_extra
if stype in ['mysql', 'wp', 'wpsubdir', 'wpsubdomain']:
@@ -917,16 +911,6 @@ def site_package_check(self, stype):
if not WOAptGet.is_installed(self, 'redis-server'):
apt_packages = apt_packages + WOVar.wo_redis
if pargs.ngxblocker:
if not os.path.isdir('/etc/nginx/bots.d'):
Log.debug(self, "Setting packages variable for ngxblocker")
packages = packages + \
[["https://raw.githubusercontent.com/"
"mitchellkrogza/nginx-ultimate-bad-bot-blocker"
"/master/install-ngxblocker",
"/usr/local/sbin/install-ngxblocker",
"ngxblocker"]]
return (stack.install(apt_packages=apt_packages, packages=packages,
disp_msg=False))
@@ -1023,13 +1007,13 @@ def display_cache_settings(self, data):
if data['wpfc']:
if data['multisite']:
Log.info(self, "Nginx-Helper configuration :"
"\thttp://{0}/wp-admin/network/settings.php?"
"page=nginx".format(data['site_name']))
Log.info(self, "LiteSpeed Cache configuration :"
"\thttp://{0}/wp-admin/network/admin.php?"
"page=litespeed".format(data['site_name']))
else:
Log.info(self, "Nginx-Helper configuration :"
"\thttp://{0}/wp-admin/options-general.php?"
"page=nginx".format(data['site_name']))
Log.info(self, "LiteSpeed Cache configuration :"
"\thttp://{0}/wp-admin/admin.php?"
"page=litespeed".format(data['site_name']))
if data['wpce']:
if data['multisite']:
@@ -1080,7 +1064,8 @@ def detSitePar(opts):
for key, val in opts.items():
if val and key in ['html', 'php', 'mysql', 'wp',
'wpsubdir', 'wpsubdomain',
'php74', 'php80', 'php81', 'php82', 'php83', 'php84']:
'php74', 'php80', 'php81', 'php82',
'php83', 'php84', 'php85']:
typelist.append(key)
elif val and key in ['wpfc', 'wpsc', 'wpredis', 'wprocket', 'wpce']:
cachelist.append(key)
@@ -1132,6 +1117,12 @@ def detSitePar(opts):
cachetype = 'basic'
else:
cachetype = cachelist[0]
elif False not in [x in ('php85', 'mysql', 'html') for x in typelist]:
sitetype = 'mysql'
if not cachelist:
cachetype = 'basic'
else:
cachetype = cachelist[0]
elif False not in [x in ('php', 'mysql') for x in typelist]:
sitetype = 'mysql'
if not cachelist:
@@ -1174,6 +1165,12 @@ def detSitePar(opts):
cachetype = 'basic'
else:
cachetype = cachelist[0]
elif False not in [x in ('php85', 'mysql') for x in typelist]:
sitetype = 'mysql'
if not cachelist:
cachetype = 'basic'
else:
cachetype = cachelist[0]
elif False not in [x in ('html', 'mysql') for x in typelist]:
sitetype = 'mysql'
if not cachelist:
@@ -1234,6 +1231,12 @@ def detSitePar(opts):
cachetype = 'basic'
else:
cachetype = cachelist[0]
elif False not in [x in ('wp', 'php85') for x in typelist]:
sitetype = 'wp'
if not cachelist:
cachetype = 'basic'
else:
cachetype = cachelist[0]
elif False not in [x in ('wpsubdir', 'php74') for x in typelist]:
sitetype = 'wpsubdir'
if not cachelist:
@@ -1270,6 +1273,12 @@ def detSitePar(opts):
cachetype = 'basic'
else:
cachetype = cachelist[0]
elif False not in [x in ('wpsubdir', 'php85') for x in typelist]:
sitetype = 'wpsubdir'
if not cachelist:
cachetype = 'basic'
else:
cachetype = cachelist[0]
elif False not in [x in ('wpsubdomain', 'php74') for x in typelist]:
sitetype = 'wpsubdomain'
if not cachelist:
@@ -1306,6 +1315,12 @@ def detSitePar(opts):
cachetype = 'basic'
else:
cachetype = cachelist[0]
elif False not in [x in ('wpsubdomain', 'php85') for x in typelist]:
sitetype = 'wpsubdomain'
if not cachelist:
cachetype = 'basic'
else:
cachetype = cachelist[0]
else:
raise RuntimeError("could not determine site and cache type")
else:
@@ -1330,6 +1345,9 @@ def detSitePar(opts):
elif (not typelist or "php84" in typelist) and cachelist:
sitetype = 'wp'
cachetype = cachelist[0]
elif (not typelist or "php85" in typelist) and cachelist:
sitetype = 'wp'
cachetype = cachelist[0]
elif typelist and (not cachelist):
sitetype = typelist[0]
cachetype = 'basic'
@@ -1419,16 +1437,14 @@ def deleteWebRoot(self, webroot):
return False
def removeNginxConf(self, domain):
if os.path.isfile('/etc/nginx/sites-available/{0}'
.format(domain)):
Log.debug(self, "Removing Nginx configuration")
WOFileUtils.rm(self, '/etc/nginx/sites-enabled/{0}'
.format(domain))
WOFileUtils.rm(self, '/etc/nginx/sites-available/{0}'
.format(domain))
WOService.reload_service(self, 'nginx')
WOGit.add(self, ["/etc/nginx"],
def removeOLSConf(self, domain):
vhost_dir = '{0}/{1}'.format(WOVar.wo_ols_vhost_dir, domain)
if os.path.isdir(vhost_dir):
Log.debug(self, "Removing OpenLiteSpeed configuration")
removeOLSVhost(self, domain)
WOFileUtils.rm(self, vhost_dir)
WOService.reload_service(self, 'lsws')
WOGit.add(self, [WOVar.wo_ols_conf_dir],
msg="Deleted {0} "
.format(domain))
@@ -1436,14 +1452,14 @@ def removeNginxConf(self, domain):
def doCleanupAction(self, domain='', webroot='', dbname='', dbuser='',
dbhost=''):
"""
Removes the nginx configuration and database for the domain provided.
Removes the OLS configuration and database for the domain provided.
doCleanupAction(self, domain='sitename', webroot='',
dbname='', dbuser='', dbhost='')
"""
if domain:
if os.path.isfile('/etc/nginx/sites-available/{0}'
.format(domain)):
removeNginxConf(self, domain)
vhost_dir = '{0}/{1}'.format(WOVar.wo_ols_vhost_dir, domain)
if os.path.isdir(vhost_dir):
removeOLSConf(self, domain)
WOAcme.removeconf(self, domain)
if webroot:
@@ -1463,23 +1479,27 @@ def doCleanupAction(self, domain='', webroot='', dbname='', dbuser='',
def copyWildcardCert(self, wo_domain_name, wo_root_domain):
if os.path.isfile("/var/www/{0}/conf/nginx/ssl.conf"
.format(wo_root_domain)):
root_vhost_dir = '{0}/{1}'.format(
WOVar.wo_ols_vhost_dir, wo_root_domain)
domain_vhost_dir = '{0}/{1}'.format(
WOVar.wo_ols_vhost_dir, wo_domain_name)
if os.path.isfile("{0}/ssl.conf".format(root_vhost_dir)):
try:
if not os.path.isdir("/etc/letsencrypt/shared"):
WOFileUtils.mkdir(self, "/etc/letsencrypt/shared")
if not os.path.isfile("/etc/letsencrypt/shared/{0}.conf"
.format(wo_root_domain)):
WOFileUtils.copyfile(self, "/var/www/{0}/conf/nginx/ssl.conf"
.format(wo_root_domain),
WOFileUtils.copyfile(self,
"{0}/ssl.conf".format(root_vhost_dir),
"/etc/letsencrypt/shared/{0}.conf"
.format(wo_root_domain))
if not os.path.isdir(domain_vhost_dir):
os.makedirs(domain_vhost_dir)
WOFileUtils.create_symlink(self, ["/etc/letsencrypt/shared/"
"{0}.conf"
.format(wo_root_domain),
'/var/www/{0}/conf/nginx/'
'ssl.conf'
.format(wo_domain_name)])
'{0}/ssl.conf'
.format(domain_vhost_dir)])
except IOError as e:
Log.debug(self, str(e))
Log.debug(self, "Error occured while "
@@ -1549,32 +1569,3 @@ def setuprocketchat(self):
return False
def setupngxblocker(self, domain, block=True):
if block:
if os.path.isdir('/var/www/{0}/conf/nginx'.format(domain)):
if not os.path.isfile(
'/var/www/{0}/conf/nginx/ngxblocker.conf.disabled'
.format(domain)):
ngxconf = open(
"/var/www/{0}/conf/nginx/ngxblocker.conf"
.format(domain),
encoding='utf-8', mode='w')
ngxconf.write(
"# Bad Bot Blocker\n"
"include /etc/nginx/bots.d/ddos.conf;\n"
"include /etc/nginx/bots.d/blockbots.conf;\n")
ngxconf.close()
else:
WOFileUtils.mvfile(
self, '/var/www/{0}/conf/nginx/ngxblocker.conf.disabled'
.format(domain), '/var/www/{0}/conf/nginx/ngxblocker.conf'
.format(domain))
else:
if os.path.isfile('/var/www/{0}/conf/nginx/ngxblocker.conf'
.format(domain)):
WOFileUtils.mvfile(
self, '/var/www/{0}/conf/nginx/ngxblocker.conf'
.format(domain),
'/var/www/{0}/conf/nginx/ngxblocker.conf.disabled'
.format(domain))
return 0