From bc723389b80787f6f2ec15c434f027be1faff5d5 Mon Sep 17 00:00:00 2001 From: "usman@cyberpersons.com" Date: Mon, 15 May 2023 21:16:10 +0500 Subject: [PATCH] apache manager --- ApachController/ApacheController.py | 3 +- ApachController/ApacheVhosts.py | 146 ++++++++- plogical/vhost.py | 21 +- plogical/vhostConfs.py | 4 +- plogical/virtualHostUtilities.py | 60 +++- .../websiteFunctions/websiteFunctions.js | 293 +++++++++++++++++- .../websiteFunctions/ApacheManager.html | 218 +++++++++++++ .../websiteFunctions/createDomain.html | 10 + .../websiteFunctions/launchChild.html | 61 ++-- .../templates/websiteFunctions/website.html | 11 + websiteFunctions/urls.py | 52 ++-- websiteFunctions/views.py | 55 ++++ websiteFunctions/website.py | 196 ++++++++---- 13 files changed, 992 insertions(+), 138 deletions(-) create mode 100755 websiteFunctions/templates/websiteFunctions/ApacheManager.html diff --git a/ApachController/ApacheController.py b/ApachController/ApacheController.py index d0609295c..c5c97be64 100755 --- a/ApachController/ApacheController.py +++ b/ApachController/ApacheController.py @@ -293,12 +293,11 @@ LoadModule mpm_event_module modules/mod_mpm_event.so if ProcessUtilities.executioner(command, None, True) == 0: return "Failed to ppa:ondrej/php" - command = "sudo apt-get install -y php-fpm php7.4-fpm php8.0-fpm php7.4-mysql php7.4-curl php7.4-gd php7.4-mbstring php7.4-xml php7.4-zip php8.0-mysql php8.0-curl php8.0-gd php8.0-mbstring php8.0-xml php8.0-zip" + command = "DEBIAN_FRONTEND=noninteractive apt-get install -y php-fpm php?.?-fpm php?.?-fpm php?.?-mysql php?.?-curl php?.?-gd php?.?-mbstring php?.?-xml php?.?-zip" if ProcessUtilities.executioner(command, None, True) == 0: return "Failed to install Apache and PHP-FPM." - try: wwwConfPath = ApacheVhost.php54Path + "/www.conf" diff --git a/ApachController/ApacheVhosts.py b/ApachController/ApacheVhosts.py index 30d3ed9b7..0b455381c 100755 --- a/ApachController/ApacheVhosts.py +++ b/ApachController/ApacheVhosts.py @@ -29,6 +29,8 @@ class ApacheVhost: php72Path = '/etc/opt/remi/php72/php-fpm.d/' php73Path = '/etc/opt/remi/php73/php-fpm.d/' + serviceName = 'httpd' + else: serverRootPath = '/etc/apache2' configBasePath = '/etc/apache2/sites-enabled/' @@ -46,6 +48,8 @@ class ApacheVhost: php81Path = '/etc/php/8.1/fpm/pool.d/' php82Path = '/etc/php/8.2/fpm/pool.d/' + serviceName = 'apache2' + lswsMainConf = "/usr/local/lsws/conf/httpd_config.conf" @@ -139,8 +143,10 @@ class ApacheVhost: if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: sockPath = '/var/run/php-fpm/' + group = 'nobody' else: sockPath = '/var/run/php/' + group = 'nogroup' ## Non-SSL Conf @@ -191,12 +197,13 @@ class ApacheVhost: currentConf = currentConf.replace('{Sock}', virtualHostName) currentConf = currentConf.replace('{externalApp}', externalApp) currentConf = currentConf.replace('{sockPath}', sockPath) + currentConf = currentConf.replace('{group}', group) confFile.write(currentConf) ApacheVhost.GenerateSelfSignedSSL(virtualHostName) - command = "systemctl restart httpd" + command = f"systemctl restart {ApacheVhost.serviceName}" ProcessUtilities.normalExecutioner(command) return [1, 'None'] @@ -262,8 +269,10 @@ class ApacheVhost: if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: sockPath = '/var/run/php-fpm/' + group = 'nobody' else: sockPath = '/var/run/php/' + group = 'nogroup' finalConfPath = ApacheVhost.configBasePath + virtualHostName + '.conf' confFile = open(finalConfPath, "w+") @@ -312,12 +321,13 @@ class ApacheVhost: currentConf = currentConf.replace('{Sock}', virtualHostName) currentConf = currentConf.replace('{externalApp}', externalApp) currentConf = currentConf.replace('{sockPath}', sockPath) + currentConf = currentConf.replace('{group}', group) confFile.write(currentConf) ApacheVhost.GenerateSelfSignedSSL(virtualHostName) - command = "systemctl restart httpd" + command = f"systemctl restart {ApacheVhost.serviceName}" ProcessUtilities.normalExecutioner(command) return [1, 'None'] @@ -326,6 +336,7 @@ class ApacheVhost: @staticmethod def setupApacheVhostChild(administratorEmail, externalApp, virtualHostUser, phpVersion, virtualHostName, path): + result = ApacheVhost.perHostVirtualConfChild(administratorEmail, externalApp, virtualHostUser, phpVersion, virtualHostName, path) if result[0] == 0: @@ -347,7 +358,7 @@ class ApacheVhost: ApacheVhost.deletePHPPath(virtualHostName) - command = "systemctl restart httpd" + command = f"systemctl restart {ApacheVhost.serviceName}" ProcessUtilities.normalExecutioner(command) except BaseException as msg: @@ -375,59 +386,154 @@ class ApacheVhost: phpPath = ApacheVhost.DecidePHPPath('54', virtualHostName) if os.path.exists(phpPath): os.remove(phpPath) - command = "systemctl restart php%s-php-fpm" % ('54') + + if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: + phpService = f'php54-php-fpm' + else: + phpService = f"php5.4-fpm" + + command = f"systemctl restart {phpService}" ProcessUtilities.normalExecutioner(command) phpPath = ApacheVhost.DecidePHPPath('55', virtualHostName) if os.path.exists(phpPath): + os.remove(phpPath) - command = "systemctl restart php%s-php-fpm" % ('55') + + if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: + phpService = f'php55-php-fpm' + else: + phpService = f"php5.5-fpm" + + command = f"systemctl restart {phpService}" ProcessUtilities.normalExecutioner(command) phpPath = ApacheVhost.DecidePHPPath('56', virtualHostName) if os.path.exists(phpPath): os.remove(phpPath) - command = "systemctl restart php%s-php-fpm" % ('56') + if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: + phpService = f'php56-php-fpm' + else: + phpService = f"php5.6-fpm" + + command = f"systemctl restart {phpService}" ProcessUtilities.normalExecutioner(command) phpPath = ApacheVhost.DecidePHPPath('70', virtualHostName) if os.path.exists(phpPath): os.remove(phpPath) - command = "systemctl restart php%s-php-fpm" % ('70') + if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: + phpService = f'php70-php-fpm' + else: + phpService = f"php7.0-fpm" + + command = f"systemctl restart {phpService}" ProcessUtilities.normalExecutioner(command) phpPath = ApacheVhost.DecidePHPPath('71', virtualHostName) if os.path.exists(phpPath): os.remove(phpPath) - command = "systemctl restart php%s-php-fpm" % ('71') + if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: + phpService = f'php71-php-fpm' + else: + phpService = f"php7.1-fpm" + + command = f"systemctl restart {phpService}" ProcessUtilities.normalExecutioner(command) phpPath = ApacheVhost.DecidePHPPath('72', virtualHostName) if os.path.exists(phpPath): os.remove(phpPath) - command = "systemctl restart php%s-php-fpm" % ('72') + if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: + phpService = f'php72-php-fpm' + else: + phpService = f"php7.2-fpm" + + command = f"systemctl restart {phpService}" ProcessUtilities.normalExecutioner(command) phpPath = ApacheVhost.DecidePHPPath('73', virtualHostName) if os.path.exists(phpPath): os.remove(phpPath) - command = "systemctl restart php%s-php-fpm" % ('73') + if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: + phpService = f'php73-php-fpm' + else: + phpService = f"php7.3-fpm" + + command = f"systemctl restart {phpService}" + ProcessUtilities.normalExecutioner(command) + + phpPath = ApacheVhost.DecidePHPPath('74', virtualHostName) + if os.path.exists(phpPath): + os.remove(phpPath) + if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: + phpService = f'php74-php-fpm' + else: + phpService = f"php7.4-fpm" + + command = f"systemctl restart {phpService}" + ProcessUtilities.normalExecutioner(command) + + phpPath = ApacheVhost.DecidePHPPath('80', virtualHostName) + if os.path.exists(phpPath): + os.remove(phpPath) + if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: + phpService = f'php80-php-fpm' + else: + phpService = f"php8.0-fpm" + + command = f"systemctl restart {phpService}" + ProcessUtilities.normalExecutioner(command) + + phpPath = ApacheVhost.DecidePHPPath('81', virtualHostName) + if os.path.exists(phpPath): + os.remove(phpPath) + if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: + phpService = f'php81-php-fpm' + else: + phpService = f"php8.1-fpm" + + command = f"systemctl restart {phpService}" + ProcessUtilities.normalExecutioner(command) + + phpPath = ApacheVhost.DecidePHPPath('82', virtualHostName) + if os.path.exists(phpPath): + os.remove(phpPath) + if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: + phpService = f'php82-php-fpm' + else: + phpService = f"php8.2-fpm" + + command = f"systemctl restart {phpService}" ProcessUtilities.normalExecutioner(command) @staticmethod def changePHP(phpVersion, vhFile): try: + if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: + sockPath = '/var/run/php-fpm/' + group = 'nobody' + else: + sockPath = '/var/run/php/' + group = 'nogroup' + virtualHostName = vhFile.split('/')[6] finalConfPath = ApacheVhost.configBasePath + virtualHostName + '.conf' if not os.path.exists(finalConfPath): + logging.writeToFile(f'Config path: {finalConfPath}') return 0 ApacheVhost.deletePHPPath(virtualHostName) - website = Websites.objects.get(domain=virtualHostName) + try: + website = Websites.objects.get(domain=virtualHostName) + externalApp = website.externalApp + except: + child = ChildDomains.objects.get(domain=virtualHostName) + externalApp = child.master.externalApp php = PHPManager.getPHPString(phpVersion) @@ -435,16 +541,26 @@ class ApacheVhost: confFile = open(finalConfPath, "w+") currentConf = vhostConfs.phpFpmPool - currentConf = currentConf.replace('{www}', website.externalApp) + currentConf = currentConf.replace('{www}', externalApp) currentConf = currentConf.replace('{Sock}', virtualHostName) - currentConf = currentConf.replace('{externalApp}', website.externalApp) + currentConf = currentConf.replace('{externalApp}', externalApp) + currentConf = currentConf.replace('{sockPath}', sockPath) + currentConf = currentConf.replace('{group}', group) confFile.write(currentConf) - command = "systemctl stop php%s-php-fpm" % (php) + if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: + phpService = f'php{php}-php-fpm' + else: + phpService = f"{phpVersion.replace(' ', '').lower()}-fpm" + + command = f"systemctl stop {phpService}" ProcessUtilities.normalExecutioner(command) - command = "systemctl restart php%s-php-fpm" % (php) + command = f"systemctl restart {phpService}" + ProcessUtilities.normalExecutioner(command) + + command = f"systemctl restart {ApacheVhost.serviceName}" ProcessUtilities.normalExecutioner(command) return 1 diff --git a/plogical/vhost.py b/plogical/vhost.py index 701f71b49..ba5fc34fc 100755 --- a/plogical/vhost.py +++ b/plogical/vhost.py @@ -618,8 +618,17 @@ class vhost: def changePHP(vhFile, phpVersion): from pathlib import Path - HomePath = Path("/home/%s" % (vhFile.split('/')[-2])) - virtualHostUser = HomePath.owner() + domain = vhFile.split('/')[6] + print(domain) + try: + website = Websites.objects.get(domain=domain) + externalApp = website.externalApp + except: + child = ChildDomains.objects.get(domain=domain) + externalApp = child.master.externalApp + #HomePath = website.externalApp + virtualHostUser = externalApp + phpDetachUpdatePath = '/home/%s/.lsphp_restart.txt' % (vhFile.split('/')[-2]) if ProcessUtilities.decideServer() == ProcessUtilities.OLS: try: @@ -657,7 +666,13 @@ class vhost: logging.CyberCPLogFileWriter.writeToFile('apache vhost 1') php = PHPManager.getPHPString(phpVersion) - command = "systemctl restart php%s-php-fpm" % (php) + + if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: + phpService = f'php{php}-php-fpm' + else: + phpService = f"{phpVersion.replace(' ', '').lower()}-fpm" + + command = f"systemctl restart {phpService}" ProcessUtilities.normalExecutioner(command) print("1,None") diff --git a/plogical/vhostConfs.py b/plogical/vhostConfs.py index 7eae1a56d..fdbde9701 100755 --- a/plogical/vhostConfs.py +++ b/plogical/vhostConfs.py @@ -385,7 +385,7 @@ REWRITERULE ^(.*)$ HTTP://proxyApacheBackendSSL/$1 [P,L] phpFpmPool = """[{www}] listen = {sockPath}{Sock}.sock listen.owner = nobody -listen.group = nobody +listen.group = {group} listen.mode = 0660 user = {externalApp} group = {externalApp} @@ -398,7 +398,7 @@ pm.max_spare_servers = 1 phpFpmPoolReplace = """[{www}] listen = {sockPath}{Sock}.sock listen.owner = nobody -listen.group = nobody +listen.group = {group} listen.mode = 0660 user = {externalApp} group = {externalApp} diff --git a/plogical/virtualHostUtilities.py b/plogical/virtualHostUtilities.py index 64d8ecf88..80e008bb0 100644 --- a/plogical/virtualHostUtilities.py +++ b/plogical/virtualHostUtilities.py @@ -244,7 +244,13 @@ class virtualHostUtilities: ApacheVhost.perHostVirtualConfOLS(completePathToConfigFile, administratorEmail) installUtilities.installUtilities.reStartLiteSpeed() php = PHPManager.getPHPString(phpVersion) - command = "systemctl restart php%s-php-fpm" % (php) + + if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: + phpService = f'php{php}-php-fpm' + else: + phpService = f"{phpVersion.replace(' ', '').lower()}-fpm" + + command = f"systemctl restart {phpService}" ProcessUtilities.normalExecutioner(command) ## Create Configurations ends here @@ -437,6 +443,29 @@ class virtualHostUtilities: str(msg) + " [saveVHostConfigs]") print("0," + str(msg)) + @staticmethod + def saveApacheConfigsToFile(fileName, tempPath): + try: + + vhost = open(fileName, "w") + + vhost.write(open(tempPath, "r").read()) + + vhost.close() + + if os.path.exists(tempPath): + os.remove(tempPath) + + command = f"systemctl restart {ApacheVhost.serviceName}" + ProcessUtilities.normalExecutioner(command) + + print("1,None") + + except BaseException as msg: + logging.CyberCPLogFileWriter.writeToFile( + str(msg) + " [saveApacheConfigsToFile]") + print("0," + str(msg)) + @staticmethod def saveRewriteRules(virtualHost, fileName, tempPath): try: @@ -1094,7 +1123,13 @@ class virtualHostUtilities: ApacheVhost.perHostVirtualConfOLS(completePathToConfigFile, master.adminEmail) installUtilities.installUtilities.reStartLiteSpeed() php = PHPManager.getPHPString(phpVersion) - command = "systemctl restart php%s-php-fpm" % (php) + + if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: + phpService = f'php{php}-php-fpm' + else: + phpService = f"{phpVersion.replace(' ', '').lower()}-fpm" + + command = f"systemctl restart {phpService}" ProcessUtilities.normalExecutioner(command) ## DKIM Check @@ -1183,8 +1218,25 @@ class virtualHostUtilities: logging.CyberCPLogFileWriter.statusWriter(tempStatusPath, 'Restarting servers and phps..,90') php = PHPManager.getPHPString(phpVersion) - command = "systemctl restart php%s-php-fpm" % (php) + + ## + + if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: + phpService = f'php{php}-php-fpm' + else: + phpService = f"{phpVersion.replace(' ', '').lower()}-fpm" + + command = f"systemctl stop {phpService}" ProcessUtilities.normalExecutioner(command) + + command = f"systemctl restart {phpService}" + ProcessUtilities.normalExecutioner(command) + + command = f"systemctl restart {ApacheVhost.serviceName}" + ProcessUtilities.normalExecutioner(command) + + ### + installUtilities.installUtilities.reStartLiteSpeed() logging.CyberCPLogFileWriter.statusWriter(tempStatusPath, 'Successfully converted.[200]') else: @@ -1561,6 +1613,8 @@ def main(): virtualHostUtilities.getErrorLogs(args.path, int(args.page)) elif args.function == "saveVHostConfigs": virtualHostUtilities.saveVHostConfigs(args.path, args.tempPath) + elif args.function == "saveApacheConfigsToFile": + virtualHostUtilities.saveApacheConfigsToFile(args.path, args.tempPath) elif args.function == "saveRewriteRules": virtualHostUtilities.saveRewriteRules(args.virtualHostName, args.path, args.tempPath) elif args.function == "saveSSL": diff --git a/websiteFunctions/static/websiteFunctions/websiteFunctions.js b/websiteFunctions/static/websiteFunctions/websiteFunctions.js index 074b20925..53a0d6b1f 100755 --- a/websiteFunctions/static/websiteFunctions/websiteFunctions.js +++ b/websiteFunctions/static/websiteFunctions/websiteFunctions.js @@ -4518,7 +4518,7 @@ app.controller('websitePages', function ($scope, $http, $timeout, $window) { $scope.currentStatus = "Starting creation.."; $scope.DomainCreateForm = true; - var ssl, dkimCheck, openBasedir; + var ssl, dkimCheck, openBasedir, apacheBackend; if ($scope.sslCheck === true) { ssl = 1; @@ -4539,6 +4539,13 @@ app.controller('websitePages', function ($scope, $http, $timeout, $window) { } + if ($scope.apacheBackend === true) { + apacheBackend = 1; + } else { + apacheBackend = 0 + } + + url = "/websites/submitDomainCreation"; var domainName = $scope.domainNameCreate; var phpSelection = $scope.phpSelection; @@ -4567,7 +4574,8 @@ app.controller('websitePages', function ($scope, $http, $timeout, $window) { path: path, masterDomain: $scope.masterDomain, dkimCheck: dkimCheck, - openBasedir: openBasedir + openBasedir: openBasedir, + apacheBackend: apacheBackend }; var config = { @@ -9694,3 +9702,284 @@ app.controller('manageGIT', function ($scope, $http, $timeout, $window) { }); /* Java script code to git tracking ends here */ + + +app.controller('ApacheManager', function ($scope, $http, $timeout) { + $scope.cyberpanelloading = true; + $scope.apacheOLS = true; + $scope.pureOLS = true; + $scope.lswsEnt = true; + + var apache = 1, ols = 2, lsws = 3; + var statusFile; + + $scope.getSwitchStatus = function () { + $scope.cyberpanelloading = false; + url = "/websites/getSwitchStatus"; + + var data = { + domainName: $("#domainNamePage").text() + }; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + $http.post(url, data, config).then(ListInitialData, cantLoadInitialData); + + + function ListInitialData(response) { + $scope.cyberpanelloading = true; + if (response.data.status === 1) { + if (response.data.server === apache) { + $scope.apacheOLS = false; + $scope.pureOLS = true; + $scope.lswsEnt = true; + $scope.configData = response.data.configData; + + $scope.pmMaxChildren = response.data.pmMaxChildren; + $scope.pmStartServers = response.data.pmStartServers; + $scope.pmMinSpareServers = response.data.pmMinSpareServers; + $scope.pmMaxSpareServers = response.data.pmMaxSpareServers; + $scope.phpPath = response.data.phpPath; + + + } else if (response.data.server === ols) { + $scope.apacheOLS = true; + $scope.pureOLS = false; + $scope.lswsEnt = true; + } else { + $scope.apacheOLS = true; + $scope.pureOLS = true; + $scope.lswsEnt = false; + } + //$scope.records = JSON.parse(response.data.data); + } else { + new PNotify({ + title: 'Operation Failed!', + text: response.data.error_message, + type: 'error' + }); + } + } + + function cantLoadInitialData(response) { + $scope.cyberpanelloading = true; + new PNotify({ + title: 'Operation Failed!', + text: 'Could not connect to server, please refresh this page.', + type: 'error' + }); + } + + + }; + $scope.getSwitchStatus(); + + $scope.switchServer = function (server) { + $scope.cyberpanelloading = false; + $scope.functionProgress = {"width": "0%"}; + $scope.functionStatus = 'Starting conversion..'; + + url = "/websites/switchServer"; + + var data = { + domainName: $("#domainNamePage").text(), + phpSelection: $scope.phpSelection, + server: server + }; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + $http.post(url, data, config).then(ListInitialData, cantLoadInitialData); + + function ListInitialData(response) { + if (response.data.status === 1) { + statusFile = response.data.tempStatusPath; + statusFunc(); + + } else { + $scope.cyberpanelloading = true; + new PNotify({ + title: 'Operation Failed!', + text: response.data.error_message, + type: 'error' + }); + } + + } + + function cantLoadInitialData(response) { + $scope.cyberpanelloading = true; + new PNotify({ + title: 'Operation Failed!', + text: 'Could not connect to server, please refresh this page.', + type: 'error' + }); + } + + + }; + + function statusFunc() { + $scope.cyberpanelloading = false; + url = "/websites/statusFunc"; + + var data = { + statusFile: statusFile + }; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + $http.post(url, data, config).then(ListInitialData, cantLoadInitialData); + + + function ListInitialData(response) { + if (response.data.status === 1) { + if (response.data.abort === 1) { + $scope.functionProgress = {"width": "100%"}; + $scope.functionStatus = response.data.currentStatus; + $scope.cyberpanelloading = true; + $timeout.cancel(); + $scope.getSwitchStatus(); + } else { + $scope.functionProgress = {"width": response.data.installationProgress + "%"}; + $scope.functionStatus = response.data.currentStatus; + $timeout(statusFunc, 3000); + } + + } else { + $scope.cyberpanelloading = true; + $scope.functionStatus = response.data.error_message; + $scope.functionProgress = {"width": response.data.installationProgress + "%"}; + $timeout.cancel(); + } + + } + + function cantLoadInitialData(response) { + $scope.functionProgress = {"width": response.data.installationProgress + "%"}; + $scope.functionStatus = 'Could not connect to server, please refresh this page.'; + $timeout.cancel(); + } + + } + + + $scope.tuneSettings = function () { + $scope.cyberpanelloading = false; + + url = "/websites/tuneSettings"; + + var data = { + domainName: $("#domainNamePage").text(), + pmMaxChildren: $scope.pmMaxChildren, + pmStartServers: $scope.pmStartServers, + pmMinSpareServers: $scope.pmMinSpareServers, + pmMaxSpareServers: $scope.pmMaxSpareServers, + phpPath: $scope.phpPath + }; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + $http.post(url, data, config).then(ListInitialData, cantLoadInitialData); + + function ListInitialData(response) { + $scope.cyberpanelloading = true; + if (response.data.status === 1) { + + new PNotify({ + title: 'Success', + text: 'Changes successfully applied.', + type: 'success' + }); + + } else { + $scope.cyberpanelloading = true; + new PNotify({ + title: 'Operation Failed!', + text: response.data.error_message, + type: 'error' + }); + } + + } + + function cantLoadInitialData(response) { + $scope.cyberpanelloading = true; + new PNotify({ + title: 'Operation Failed!', + text: 'Could not connect to server, please refresh this page.', + type: 'error' + }); + } + + + }; + + $scope.saveApacheConfig = function () { + $scope.cyberpanelloading = false; + + url = "/websites/saveApacheConfigsToFile"; + + var data = { + domainName: $("#domainNamePage").text(), + configData: $scope.configData + }; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + $http.post(url, data, config).then(ListInitialData, cantLoadInitialData); + + function ListInitialData(response) { + $scope.cyberpanelloading = true; + if (response.data.status === 1) { + + new PNotify({ + title: 'Success', + text: 'Changes successfully applied.', + type: 'success' + }); + + } else { + $scope.cyberpanelloading = true; + new PNotify({ + title: 'Operation Failed!', + text: response.data.error_message, + type: 'error' + }); + } + + } + + function cantLoadInitialData(response) { + $scope.cyberpanelloading = true; + new PNotify({ + title: 'Operation Failed!', + text: 'Could not connect to server, please refresh this page.', + type: 'error' + }); + } + + + }; + +}); \ No newline at end of file diff --git a/websiteFunctions/templates/websiteFunctions/ApacheManager.html b/websiteFunctions/templates/websiteFunctions/ApacheManager.html new file mode 100755 index 000000000..c440de014 --- /dev/null +++ b/websiteFunctions/templates/websiteFunctions/ApacheManager.html @@ -0,0 +1,218 @@ +{% extends "baseTemplate/index.html" %} +{% load i18n %} +{% block title %}{% trans "Apache Manager - CyberPanel" %}{% endblock %} +{% block content %} + + {% load static %} + {% get_current_language as LANGUAGE_CODE %} + + +
+
+

{% trans "Apache Manager" %}

+

{% trans "Switch between Apache (as reverse proxy) and OpenLiteSpeed." %}

+
+ + +
+
+

+ {{ domainName }} +

+ +
+
{{ domainName }} is currently using Apache as Reverse + Proxy to + OpenLiteSpeed.
+ +
+
+
+ + +
+
+
+ Switch to pure + OpenLiteSpeed. + + +
+ +
+ +
+

Apache Configurations

+
+ +
+
+
+ +
+
+
+
+ +
+ + + +
+

PHP-FPM Configurations

+ +
+
+
+
+ + +
+
+
+
+ + +
+
+
+ +
+
+
+ + +
+
+
+
+ + +
+
+
+
+ Tune PHP-FPM Settings. + +

{{ domainName }} is currently using pure + OpenLiteSpeed, PHP-FPM + is + not used with OpenLiteSpeed, thus tuning is disabled.

+ +

{{ domainName }} is using LiteSpeed Enterprise. + PHP-FPM is not + used + with LiteSpeed + Enterprise.

+
+ + + + + + +
+ +

{{ domainName }} is currently using pure OpenLiteSpeed.

+
+
+
+ + +
+
+
+ Switch to OpenLiteSpeed + + Apache + as reverse proxy. + +

{{ domainName }} is using LiteSpeed Enterprise. When + LiteSpeed + Enterprise is active switching is not required.

+
+ + + + + +
+ + +
+ + +
+ + +{% endblock %} \ No newline at end of file diff --git a/websiteFunctions/templates/websiteFunctions/createDomain.html b/websiteFunctions/templates/websiteFunctions/createDomain.html index 551d06fd9..a67e6fbce 100755 --- a/websiteFunctions/templates/websiteFunctions/createDomain.html +++ b/websiteFunctions/templates/websiteFunctions/createDomain.html @@ -264,6 +264,16 @@ + +
+
+ +
+
+
diff --git a/websiteFunctions/templates/websiteFunctions/launchChild.html b/websiteFunctions/templates/websiteFunctions/launchChild.html index 36b80d288..c62a51349 100755 --- a/websiteFunctions/templates/websiteFunctions/launchChild.html +++ b/websiteFunctions/templates/websiteFunctions/launchChild.html @@ -26,13 +26,17 @@

{% trans "Resource Usage" %} - {% trans "Manage Git" %} + {% trans "Manage Git" %} {% trans "Copy/Sync to Master" %} {% trans "Stress Test" %} + href="https://go.cyberpanel.net/StessTest" + title="">{% trans "Stress Test" %}

@@ -277,6 +281,17 @@
+ + -{# #} + {# #} diff --git a/websiteFunctions/templates/websiteFunctions/website.html b/websiteFunctions/templates/websiteFunctions/website.html index 532de9a97..9a9c6e966 100755 --- a/websiteFunctions/templates/websiteFunctions/website.html +++ b/websiteFunctions/templates/websiteFunctions/website.html @@ -532,6 +532,17 @@
+ +
diff --git a/websiteFunctions/urls.py b/websiteFunctions/urls.py index 115159d02..442309232 100755 --- a/websiteFunctions/urls.py +++ b/websiteFunctions/urls.py @@ -1,7 +1,6 @@ from django.conf.urls import url from . import views - urlpatterns = [ url(r'^$', views.loadWebsitesHome, name='loadWebsitesHome'), url(r'^createWebsite$', views.createWebsite, name='createWebsite'), @@ -15,7 +14,6 @@ urlpatterns = [ url(r'^CreateNewDomain$', views.CreateNewDomain, name='CreateNewDomain'), - ### WordPress url(r'^createWordpress$', views.WPCreate, name='createWordpress'), url(r'^ListWPSites$', views.ListWPSites, name='ListWPSites'), @@ -28,7 +26,6 @@ urlpatterns = [ url(r'^AddRemoteBackupsite$', views.AddRemoteBackupsite, name='AddRemoteBackupsite'), url(r'^pricing$', views.WordpressPricing, name='pricing'), - ###WordPress Ajax url(r'^submitWorpressCreation', views.submitWorpressCreation, name='submitWorpressCreation'), url(r'^FetchWPdata', views.FetchWPdata, name='FetchWPdata'), @@ -56,26 +53,19 @@ urlpatterns = [ url(r'^UpdateRemoteschedules', views.UpdateRemoteschedules, name='UpdateRemoteschedules'), url(r'^ScanWordpressSite', views.ScanWordpressSite, name='ScanWordpressSite'), - - - #### AddPlugin url(r'^ConfigurePlugins$', views.ConfigurePlugins, name='ConfigurePlugins'), url(r'^Addnewplugin$', views.Addnewplugin, name='Addnewplugin'), url(r'^EidtPlugin$', views.EidtPlugin, name='EidtPlugin'), - - ## AddPlugin Ajax url(r'^SearchOnkeyupPlugin$', views.SearchOnkeyupPlugin, name='SearchOnkeyupPlugin'), url(r'^AddNewpluginAjax$', views.AddNewpluginAjax, name='AddNewpluginAjax'), url(r'^deletesPlgin', views.deletesPlgin, name='deletesPlgin'), url(r'^Addplugineidt', views.Addplugineidt, name='Addplugineidt'), - # Website modification url - url(r'^submitWebsiteCreation$', views.submitWebsiteCreation, name='submitWebsiteCreation'), url(r'^submitWebsiteDeletion$', views.submitWebsiteDeletion, name='submitWebsiteDeletion'), url(r'^submitWebsiteListing$', views.getFurtherAccounts, name='submitWebsiteListing'), @@ -86,18 +76,16 @@ urlpatterns = [ url(r'^submitWebsiteModification$', views.deleteWebsite, name='submitWebsiteModification'), url(r'^submitWebsiteStatus$', views.submitWebsiteStatus, name='submitWebsiteStatus'), - url(r'^getWebsiteDetails$', views.submitWebsiteModify, name='getWebsiteDetails'), url(r'^saveWebsiteChanges', views.saveWebsiteChanges, name='saveWebsiteChanges'), url(r'^getDataFromLogFile$', views.getDataFromLogFile, name='getDataFromLogFile'), url(r'^fetchErrorLogs$', views.fetchErrorLogs, name='fetchErrorLogs'), - + url(r'^getDataFromConfigFile$', views.getDataFromConfigFile, name='getDataFromConfigFile'), url(r'^saveConfigsToFile$', views.saveConfigsToFile, name='saveConfigsToFile'), - url(r'^getRewriteRules$', views.getRewriteRules, name='getRewriteRules'), url(r'^saveRewriteRules$', views.saveRewriteRules, name='saveRewriteRules'), @@ -116,32 +104,29 @@ urlpatterns = [ url(r'^searchChilds$', views.searchChilds, name='searchChilds'), # crons - url(r'^listCron$',views.listCron,name="listCron"), - url(r'^getWebsiteCron$',views.getWebsiteCron,name="getWebsiteCron"), - url(r'^getCronbyLine$',views.getCronbyLine,name="getCronbyLine"), - url(r'^remCronbyLine$',views.remCronbyLine,name="remCronbyLine"), - url(r'^saveCronChanges$',views.saveCronChanges,name="saveCronChanges"), - url(r'^addNewCron$',views.addNewCron,name="addNewCron"), - + url(r'^listCron$', views.listCron, name="listCron"), + url(r'^getWebsiteCron$', views.getWebsiteCron, name="getWebsiteCron"), + url(r'^getCronbyLine$', views.getCronbyLine, name="getCronbyLine"), + url(r'^remCronbyLine$', views.remCronbyLine, name="remCronbyLine"), + url(r'^saveCronChanges$', views.saveCronChanges, name="saveCronChanges"), + url(r'^addNewCron$', views.addNewCron, name="addNewCron"), ## Domain Alias url(r'^(?P(.*))/domainAlias$', views.domainAlias, name='domainAlias'), - url(r'^submitAliasCreation$',views.submitAliasCreation,name="submitAliasCreation"), - url(r'^issueAliasSSL$',views.issueAliasSSL,name="issueAliasSSL"), - url(r'^delateAlias$',views.delateAlias,name="delateAlias"), - + url(r'^submitAliasCreation$', views.submitAliasCreation, name="submitAliasCreation"), + url(r'^issueAliasSSL$', views.issueAliasSSL, name="issueAliasSSL"), + url(r'^delateAlias$', views.delateAlias, name="delateAlias"), ## Openbasedir - url(r'^changeOpenBasedir$',views.changeOpenBasedir,name="changeOpenBasedir"), + url(r'^changeOpenBasedir$', views.changeOpenBasedir, name="changeOpenBasedir"), ## WP Install url(r'^(?P(.*))/wordpressInstall$', views.wordpressInstall, name='wordpressInstall'), - url(r'^installWordpressStatus$',views.installWordpressStatus,name="installWordpressStatus"), + url(r'^installWordpressStatus$', views.installWordpressStatus, name="installWordpressStatus"), url(r'^installWordpress$', views.installWordpress, name='installWordpress'), - ## Joomla Install url(r'^installJoomla$', views.installJoomla, name='installJoomla'), @@ -162,7 +147,6 @@ urlpatterns = [ url(r'^(?P(.*))/installMautic$', views.installMautic, name='installMautic'), url(r'^mauticInstall$', views.mauticInstall, name='mauticInstall'), - ## Git url(r'^(?P(.*))/setupGit$', views.setupGit, name='setupGit'), url(r'^setupGitRepo$', views.setupGitRepo, name='setupGitRepo'), @@ -178,7 +162,6 @@ urlpatterns = [ url(r'^(?P(.*))/(?P(.*))/syncToMaster$', views.syncToMaster, name='syncToMaster'), url(r'^startSync$', views.startSync, name='startSync'), - url(r'^(?P(.*))/gitNotify$', views.gitNotify, name='gitNotify'), url(r'^detachRepo$', views.detachRepo, name='detachRepo'), url(r'^changeBranch$', views.changeBranch, name='changeBranch'), @@ -211,8 +194,17 @@ urlpatterns = [ url(r'^deleteSSHKey$', views.deleteSSHKey, name='deleteSSHKey'), url(r'^addSSHKey$', views.addSSHKey, name='addSSHKey'), + ### Apache Manager + + url(r'^ApacheManager/(?P(.*))$', views.ApacheManager, name='ApacheManager'), + url(r'^getSwitchStatus$', views.getSwitchStatus, name='getSwitchStatus'), + url(r'^switchServer$', views.switchServer, name='switchServer'), + url(r'^statusFunc$', views.statusFunc, name='statusFunc'), + url(r'^tuneSettings$', views.tuneSettings, name='tuneSettings'), + url(r'^saveApacheConfigsToFile$', views.saveApacheConfigsToFile, name='saveApacheConfigsToFile'), ## Catch all for domains url(r'^(?P(.*))/(?P(.*))$', views.launchChild, name='launchChild'), url(r'^(?P(.*))$', views.domain, name='domain'), -] \ No newline at end of file + +] diff --git a/websiteFunctions/views.py b/websiteFunctions/views.py index 13a3214b0..2b66c47e5 100755 --- a/websiteFunctions/views.py +++ b/websiteFunctions/views.py @@ -1695,3 +1695,58 @@ def webhook(request, domain): return wm.webhook(domain, json.loads(request.body)) except KeyError: return redirect(loadLoginPage) + + +def ApacheManager(request, domain): + try: + userID = request.session['userID'] + wm = WebsiteManager(domain) + return wm.ApacheManager(request, userID) + except KeyError: + return redirect(loadLoginPage) + + +def getSwitchStatus(request): + try: + userID = request.session['userID'] + wm = WebsiteManager() + return wm.getSwitchStatus(userID, json.loads(request.body)) + except KeyError: + return redirect(loadLoginPage) + +def switchServer(request): + try: + userID = request.session['userID'] + wm = WebsiteManager() + return wm.switchServer(userID, json.loads(request.body)) + except KeyError: + return redirect(loadLoginPage) + +def statusFunc(request): + try: + userID = request.session['userID'] + data = json.loads(request.body) + from cloudAPI.cloudManager import CloudManager + admin = Administrator.objects.get(pk=userID) + cm = CloudManager(data, admin) + return cm.statusFunc() + except KeyError: + return redirect(loadLoginPage) + +def tuneSettings(request): + try: + userID = request.session['userID'] + data = json.loads(request.body) + wm = WebsiteManager() + return wm.tuneSettings(userID, data) + except KeyError: + return redirect(loadLoginPage) + +def saveApacheConfigsToFile(request): + try: + userID = request.session['userID'] + data = json.loads(request.body) + wm = WebsiteManager() + return wm.saveApacheConfigsToFile(userID, data) + except KeyError: + return redirect(loadLoginPage) diff --git a/websiteFunctions/website.py b/websiteFunctions/website.py index d389425f9..043c1f58d 100755 --- a/websiteFunctions/website.py +++ b/websiteFunctions/website.py @@ -4527,6 +4527,7 @@ StrictHostKeyChecking no data['pmMinSpareServers'] = pmMinSpareServers data['pmMaxSpareServers'] = pmMaxSpareServers data['phpPath'] = phpPath + data['configData'] = ProcessUtilities.outputExecutioner(f'cat {finalConfPath}') else: data = {} data['status'] = 1 @@ -4572,74 +4573,98 @@ StrictHostKeyChecking no return HttpResponse(json_data) def tuneSettings(self, userID=None, data=None): - - currentACL = ACLManager.loadedACL(userID) - admin = Administrator.objects.get(pk=userID) - domainName = data['domainName'] - pmMaxChildren = data['pmMaxChildren'] - pmStartServers = data['pmStartServers'] - pmMinSpareServers = data['pmMinSpareServers'] - pmMaxSpareServers = data['pmMaxSpareServers'] - phpPath = data['phpPath'] - - if ACLManager.checkOwnership(domainName, admin, currentACL) == 1: - pass - else: - return ACLManager.loadErrorJson() - - if int(pmStartServers) < int(pmMinSpareServers) or int(pmStartServers) > int(pmMinSpareServers): - data_ret = {'status': 0, - 'error_message': 'pm.start_servers must not be less than pm.min_spare_servers and not greater than pm.max_spare_servers.'} - json_data = json.dumps(data_ret) - return HttpResponse(json_data) - - if int(pmMinSpareServers) > int(pmMaxSpareServers): - data_ret = {'status': 0, - 'error_message': 'pm.max_spare_servers must not be less than pm.min_spare_servers'} - json_data = json.dumps(data_ret) - return HttpResponse(json_data) - try: - website = Websites.objects.get(domain=domainName) - externalApp = website.externalApp - except: - website = ChildDomains.objects.get(domain=domainName) - externalApp = website.master.externalApp - tempStatusPath = "/home/cyberpanel/" + str(randint(1000, 9999)) + currentACL = ACLManager.loadedACL(userID) + admin = Administrator.objects.get(pk=userID) + domainName = data['domainName'] + pmMaxChildren = data['pmMaxChildren'] + pmStartServers = data['pmStartServers'] + pmMinSpareServers = data['pmMinSpareServers'] + pmMaxSpareServers = data['pmMaxSpareServers'] + phpPath = data['phpPath'] - phpFPMConf = vhostConfs.phpFpmPoolReplace - phpFPMConf = phpFPMConf.replace('{externalApp}', externalApp) - phpFPMConf = phpFPMConf.replace('{pmMaxChildren}', pmMaxChildren) - phpFPMConf = phpFPMConf.replace('{pmStartServers}', pmStartServers) - phpFPMConf = phpFPMConf.replace('{pmMinSpareServers}', pmMinSpareServers) - phpFPMConf = phpFPMConf.replace('{pmMaxSpareServers}', pmMaxSpareServers) - phpFPMConf = phpFPMConf.replace('{www}', "".join(re.findall("[a-zA-Z]+", domainName))[:7]) - phpFPMConf = phpFPMConf.replace('{Sock}', domainName) + if ACLManager.checkOwnership(domainName, admin, currentACL) == 1: + pass + else: + return ACLManager.loadErrorJson() - writeToFile = open(tempStatusPath, 'w') - writeToFile.writelines(phpFPMConf) - writeToFile.close() + if int(pmStartServers) < int(pmMinSpareServers) or int(pmStartServers) > int(pmMinSpareServers): + data_ret = {'status': 0, + 'error_message': 'pm.start_servers must not be less than pm.min_spare_servers and not greater than pm.max_spare_servers.'} + json_data = json.dumps(data_ret) + return HttpResponse(json_data) - command = 'sudo mv %s %s' % (tempStatusPath, phpPath) - ProcessUtilities.executioner(command) + if int(pmMinSpareServers) > int(pmMaxSpareServers): + data_ret = {'status': 0, + 'error_message': 'pm.max_spare_servers must not be less than pm.min_spare_servers'} + json_data = json.dumps(data_ret) + return HttpResponse(json_data) - phpPath = phpPath.split('/') + try: + website = Websites.objects.get(domain=domainName) + externalApp = website.externalApp + except: + website = ChildDomains.objects.get(domain=domainName) + externalApp = website.master.externalApp - if phpPath[1] == 'etc': - phpVersion = phpPath[4][3] + phpPath[4][4] - else: - phpVersion = phpPath[3][3] + phpPath[3][4] + tempStatusPath = "/home/cyberpanel/" + str(randint(1000, 9999)) - command = "systemctl stop php%s-php-fpm" % (phpVersion) - ProcessUtilities.executioner(command) + if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: + sockPath = '/var/run/php-fpm/' + group = 'nobody' + else: + sockPath = '/var/run/php/' + group = 'nogroup' - command = "systemctl restart php%s-php-fpm" % (phpVersion) - ProcessUtilities.executioner(command) + phpFPMConf = vhostConfs.phpFpmPoolReplace + phpFPMConf = phpFPMConf.replace('{externalApp}', externalApp) + phpFPMConf = phpFPMConf.replace('{pmMaxChildren}', pmMaxChildren) + phpFPMConf = phpFPMConf.replace('{pmStartServers}', pmStartServers) + phpFPMConf = phpFPMConf.replace('{pmMinSpareServers}', pmMinSpareServers) + phpFPMConf = phpFPMConf.replace('{pmMaxSpareServers}', pmMaxSpareServers) + phpFPMConf = phpFPMConf.replace('{www}', "".join(re.findall("[a-zA-Z]+", domainName))[:7]) + phpFPMConf = phpFPMConf.replace('{Sock}', domainName) + phpFPMConf = phpFPMConf.replace('{sockPath}', sockPath) + phpFPMConf = phpFPMConf.replace('{group}', group) - data_ret = {'status': 1} - json_data = json.dumps(data_ret) - return HttpResponse(json_data) + writeToFile = open(tempStatusPath, 'w') + writeToFile.writelines(phpFPMConf) + writeToFile.close() + + command = 'sudo mv %s %s' % (tempStatusPath, phpPath) + ProcessUtilities.executioner(command) + + phpPath = phpPath.split('/') + + if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: + if phpPath[1] == 'etc': + phpVersion = phpPath[4][3] + phpPath[4][4] + else: + phpVersion = phpPath[3][3] + phpPath[3][4] + else: + phpVersion = f'PHP {phpPath[2]}' + + php = PHPManager.getPHPString(phpVersion) + + if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: + phpService = f'php{php}-php-fpm' + else: + phpService = f"{phpVersion.replace(' ', '').lower()}-fpm" + + command = f"systemctl stop {phpService}" + ProcessUtilities.normalExecutioner(command) + + command = f"systemctl restart {phpService}" + ProcessUtilities.normalExecutioner(command) + + data_ret = {'status': 1} + json_data = json.dumps(data_ret) + return HttpResponse(json_data) + except BaseException as msg: + data_ret = {'status': 0, 'error_message': str(msg)} + json_data = json.dumps(data_ret) + return HttpResponse(json_data) def sshAccess(self, request=None, userID=None, data=None): currentACL = ACLManager.loadedACL(userID) @@ -6396,3 +6421,58 @@ StrictHostKeyChecking no final_dic = {'status': 0, 'add_status': 0, 'error_mssage': str(msg)} final_json = json.dumps(final_dic) return HttpResponse(final_json) + + + def ApacheManager(self, request=None, userID=None, data=None): + currentACL = ACLManager.loadedACL(userID) + admin = Administrator.objects.get(pk=userID) + + if ACLManager.checkOwnership(self.domain, admin, currentACL) == 1: + pass + else: + return ACLManager.loadError() + + phps = PHPManager.findPHPVersions() + + proc = httpProc(request, 'websiteFunctions/ApacheManager.html', {'domainName': self.domain, 'phps': phps}) + return proc.render() + + def saveApacheConfigsToFile(self, userID=None, data=None): + + currentACL = ACLManager.loadedACL(userID) + + if currentACL['admin'] != 1: + return ACLManager.loadErrorJson('configstatus', 0) + + configData = data['configData'] + self.domain = data['domainName'] + + mailUtilities.checkHome() + + tempPath = "/home/cyberpanel/" + str(randint(1000, 9999)) + + vhost = open(tempPath, "w") + + vhost.write(configData) + + vhost.close() + + ## writing data temporary to file + + filePath = ApacheVhost.configBasePath + self.domain + '.conf' + + ## save configuration data + + execPath = "/usr/local/CyberCP/bin/python " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py" + execPath = execPath + " saveApacheConfigsToFile --path " + filePath + " --tempPath " + tempPath + + output = ProcessUtilities.outputExecutioner(execPath) + + if output.find("1,None") > -1: + status = {"status": 1} + final_json = json.dumps(status) + return HttpResponse(final_json) + else: + final_dic = {'status': 0, 'error_message': output} + final_json = json.dumps(final_dic) + return HttpResponse(final_json)