Add support for custom nginx

This commit is contained in:
VirtuBox
2019-09-27 14:15:00 +02:00
parent 8f886b5dcd
commit 5fbb0f58e6
4 changed files with 21 additions and 4 deletions

View File

@@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- [STACK] Nginx server_names_hash_bucket_size automated fix
- [STACK] Nginx configuration rollback in case of failure after `wo stack upgrade --nginx
- [STACK] Nginx ultimate bad bots blocker with `wo stack install --ngxblocker`
- [STACK] Added support for custom Nginx compiled from source
### v3.9.9.1 - 2019-09-26

View File

@@ -847,6 +847,8 @@ def site_package_check(self, stype):
apt = ["nginx"] + WOVariables.wo_nginx
# apt_packages = apt_packages + WOVariables.wo_nginx
post_pref(self, apt, packages)
elif os.file.isfile('/usr/sbin/nginx'):
post_pref(self, WOVariables.wo_nginx, [])
else:
apt_packages = apt_packages + WOVariables.wo_nginx
else:
@@ -920,6 +922,16 @@ def site_package_check(self, stype):
else:
apt_packages = apt_packages + WOVariables.wo_php73
if self.app.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))

View File

@@ -159,11 +159,11 @@ class WOStackController(CementBaseController):
# Nginx
if pargs.nginx:
Log.debug(self, "Setting apt_packages variable for Nginx")
if not (WOAptGet.is_installed(self, 'nginx-custom')):
if not (WOAptGet.is_installed(self, 'nginx-plus') or
WOAptGet.is_installed(self, 'nginx')):
apt_packages = apt_packages + WOVariables.wo_nginx
if not os.path.isfile('/usr/sbin/nginx'):
apt_packages = apt_packages + WOVariables.wo_nginx
else:
if WOAptGet.is_installed(self, 'nginx-plus'):
Log.info(self, "NGINX PLUS Detected ...")
@@ -177,7 +177,7 @@ class WOStackController(CementBaseController):
apt = ["nginx"] + WOVariables.wo_nginx
self.post_pref(apt, empty_packages)
else:
Log.debug(self, "Nginx Stable already installed")
Log.debug(self, "Nginx already installed")
# Redis
if pargs.redis:

View File

@@ -94,7 +94,11 @@ class WOStackUpgradeController(CementBaseController):
if WOAptGet.is_installed(self, 'nginx-custom'):
apt_packages = apt_packages + WOVariables.wo_nginx
else:
Log.info(self, "Nginx Stable is not already installed")
if os.path.isfile(self, '/usr/sbin/nginx'):
Log.info(self, "Updating Nginx templates")
post_pref(self, WOVariables.wo_nginx, [])
else:
Log.info(self, "Nginx Stable is not already installed")
if pargs.php:
if WOAptGet.is_installed(self, 'php7.2-fpm'):