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 "Switch between Apache (as reverse proxy) and OpenLiteSpeed." %}
+
+ 

{{ 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.
+{{ domainName }} is using LiteSpeed Enterprise. When + LiteSpeed + Enterprise is active switching is not required.
+