diff --git a/ee/cli/plugins/debug.py b/ee/cli/plugins/debug.py index 2c085f1b..cad14b93 100644 --- a/ee/cli/plugins/debug.py +++ b/ee/cli/plugins/debug.py @@ -171,8 +171,15 @@ class EEDebugController(CementBaseController): "{/,/}/p \" /etc/nginx/" "conf.d/upstream.conf " "| grep 9001")): + Log.info(self, "Enabling PHP debug") - data = dict(php="9001", debug="9001", hhvm="9001") + # Check HHVM is installed if not instlled then dont not enable + # it in upstream config + if os.path.isfile("/etc/nginx/common/wpfc-hhvm.conf"): + hhvmconf=True + else: + hhvmconf=False + data = dict(php="9001", debug="9001", hhvm="9001", hhvmconf) Log.debug(self, 'Writting the Nginx debug configration to file' ' /etc/nginx/conf.d/upstream.conf ') ee_nginx = open('/etc/nginx/conf.d/upstream.conf', @@ -209,6 +216,15 @@ class EEDebugController(CementBaseController): "/etc/nginx/conf.d/upstream.conf " "| grep 9001"): Log.info(self, "Disabling PHP debug") + + # Check HHVM is installed if not instlled then dont not enable + # it in upstream config + if os.path.isfile("/etc/nginx/common/wpfc-hhvm.conf"): + hhvmconf=True + else: + hhvmconf=False + data = dict(php="9001", debug="9001", hhvm="9001", hhvmconf) + data = dict(php="9000", debug="9001", hhvm="8000") Log.debug(self, 'Writting the Nginx debug configration to file' ' /etc/nginx/conf.d/upstream.conf ') diff --git a/ee/cli/plugins/stack.py b/ee/cli/plugins/stack.py index 3d0c515a..dc2cb053 100644 --- a/ee/cli/plugins/stack.py +++ b/ee/cli/plugins/stack.py @@ -227,9 +227,10 @@ class EEStackController(CementBaseController): self.app.render((data), 'fastcgi.mustache', out=ee_nginx) ee_nginx.close() - data = dict(php="9000", debug="9001", hhvm="8000") + data = dict(php="9000", debug="9001", hhvm="8000", + hhvmconf=False) Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/conf.d/upstream.conf ') + 'file /etc/nginx/conf.d/upstream.conf') ee_nginx = open('/etc/nginx/conf.d/upstream.conf', encoding='utf-8', mode='w') self.app.render((data), 'upstream.mustache', out=ee_nginx) @@ -258,38 +259,6 @@ class EEStackController(CementBaseController): out=ee_nginx) ee_nginx.close() - Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/php-hhvm.conf') - ee_nginx = open('/etc/nginx/common/php-hhvm.conf', - encoding='utf-8', mode='w') - self.app.render((data), 'php-hhvm.mustache', - out=ee_nginx) - ee_nginx.close() - - Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/w3tc-hhvm.conf') - ee_nginx = open('/etc/nginx/common/w3tc-hhvm.conf', - encoding='utf-8', mode='w') - self.app.render((data), 'w3tc-hhvm.mustache', - out=ee_nginx) - ee_nginx.close() - - Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/wpfc-hhvm.conf') - ee_nginx = open('/etc/nginx/common/wpfc-hhvm.conf', - encoding='utf-8', mode='w') - self.app.render((data), 'wpfc-hhvm.mustache', - out=ee_nginx) - ee_nginx.close() - - Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/wpsc-hhvm.conf') - ee_nginx = open('/etc/nginx/common/wpsc-hhvm.conf', - encoding='utf-8', mode='w') - self.app.render((data), 'wpsc-hhvm.mustache', - out=ee_nginx) - ee_nginx.close() - Log.debug(self, 'Writting the nginx configuration to ' 'file /etc/nginx/common/php.conf') ee_nginx = open('/etc/nginx/common/php.conf', @@ -338,17 +307,6 @@ class EEStackController(CementBaseController): out=ee_nginx) ee_nginx.close() - # Fix whitescreen of death beacuse of missing value - # fastcgi_param SCRIPT_FILENAME $request_filename; in file - # /etc/nginx/fastcgi_params - - if not EEFileUtils.grep(self, '/etc/nginx/fastcgi_params', - 'SCRIPT_FILENAME'): - with open('/etc/nginx/fastcgi_params', - encoding='utf-8', mode='a') as ee_nginx: - ee_nginx.write('fastcgi_param \tSCRIPT_FILENAME ' - '\t$request_filename;\n') - # Pagespeed configuration Log.debug(self, 'Writting the Pagespeed Global ' 'configuration to file /etc/nginx/conf.d/' diff --git a/ee/cli/templates/upstream.mustache b/ee/cli/templates/upstream.mustache index d53d1a01..62794c58 100644 --- a/ee/cli/templates/upstream.mustache +++ b/ee/cli/templates/upstream.mustache @@ -7,8 +7,10 @@ upstream debug { # Debug Pool server 127.0.0.1:{{debug}}; } +{{#hhvmconf}} upstream hhvm { # HHVM Pool server 127.0.0.1:{{hhvm}}; server 127.0.0.1:{{php}} backup; } +{{/hhvmconf}}