mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-18 03:01:01 +01:00
feature: redis-mass hosting to take care of www.domain.com'
This commit is contained in:
@@ -261,6 +261,9 @@ class vhost:
|
||||
confFile.close()
|
||||
|
||||
else:
|
||||
|
||||
## Non-www
|
||||
|
||||
currentConf = vhostConfs.lswsRediConfMaster
|
||||
|
||||
currentConf = currentConf.replace('{virtualHostName}', virtualHostName)
|
||||
@@ -273,6 +276,21 @@ class vhost:
|
||||
command = 'redis-cli set %s' % (currentConf)
|
||||
ProcessUtilities.executioner(command)
|
||||
|
||||
## WWW
|
||||
|
||||
currentConf = vhostConfs.lswsRediConfMasterWWW
|
||||
|
||||
currentConf = currentConf.replace('{virtualHostName}', 'www.%s' % (virtualHostName))
|
||||
currentConf = currentConf.replace('{master}', virtualHostName)
|
||||
currentConf = currentConf.replace('{administratorEmail}', administratorEmail)
|
||||
currentConf = currentConf.replace('{externalApp}', virtualHostUser)
|
||||
currentConf = currentConf.replace('{php}', phpVersion.lstrip('PHP '))
|
||||
currentConf = currentConf.replace('{uid}', str(pwd.getpwnam(virtualHostUser).pw_uid))
|
||||
currentConf = currentConf.replace('{gid}', str(grp.getgrnam(virtualHostUser).gr_gid))
|
||||
|
||||
command = 'redis-cli set %s' % (currentConf)
|
||||
ProcessUtilities.executioner(command)
|
||||
|
||||
|
||||
except BaseException as msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(
|
||||
@@ -547,6 +565,9 @@ class vhost:
|
||||
command = 'redis-cli delete "vhost:%s"' % (virtualHostName)
|
||||
ProcessUtilities.executioner(command)
|
||||
|
||||
command = 'redis-cli delete "vhost:www.%s"' % (virtualHostName)
|
||||
ProcessUtilities.executioner(command)
|
||||
|
||||
@staticmethod
|
||||
def checkIfVirtualHostExists(virtualHostName):
|
||||
if os.path.exists("/home/" + virtualHostName):
|
||||
@@ -902,6 +923,9 @@ class vhost:
|
||||
confFile.close()
|
||||
|
||||
else:
|
||||
|
||||
## Non www
|
||||
|
||||
currentConf = vhostConfs.lswsRediConfChild
|
||||
|
||||
currentConf = currentConf.replace('{virtualHostName}', domain)
|
||||
@@ -916,6 +940,22 @@ class vhost:
|
||||
command = 'redis-cli set %s' % (currentConf)
|
||||
ProcessUtilities.executioner(command)
|
||||
|
||||
## www
|
||||
|
||||
currentConf = vhostConfs.lswsRediConfChildWWW
|
||||
|
||||
currentConf = currentConf.replace('{virtualHostName}', 'www.%s' % (domain))
|
||||
currentConf = currentConf.replace('{masterDomain}', masterDomain)
|
||||
currentConf = currentConf.replace('{administratorEmail}', administratorEmail)
|
||||
currentConf = currentConf.replace('{path}', path)
|
||||
currentConf = currentConf.replace('{externalApp}', virtualHostUser)
|
||||
currentConf = currentConf.replace('{php}', phpVersion.lstrip('PHP '))
|
||||
currentConf = currentConf.replace('{uid}', str(pwd.getpwnam(virtualHostUser).pw_uid))
|
||||
currentConf = currentConf.replace('{gid}', str(grp.getgrnam(virtualHostUser).gr_gid))
|
||||
|
||||
command = 'redis-cli set %s' % (currentConf)
|
||||
ProcessUtilities.executioner(command)
|
||||
|
||||
except BaseException as msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(
|
||||
str(msg) + " [IO Error with per host config file [perHostDomainConf]]")
|
||||
|
||||
@@ -374,7 +374,6 @@ pm.max_spare_servers = {pmMaxSpareServers}
|
||||
"gid": {gid},
|
||||
"phpVersion": {php},
|
||||
"custom_conf": {
|
||||
ServerAlias www.{virtualHostName}
|
||||
ServerAdmin {administratorEmail}
|
||||
CustomLog /home/{virtualHostName}/logs/{virtualHostName}.access_log combined
|
||||
<IfModule LiteSpeed>
|
||||
@@ -382,6 +381,21 @@ pm.max_spare_servers = {pmMaxSpareServers}
|
||||
</IfModule>
|
||||
}
|
||||
}'"""
|
||||
lswsRediConfMasterWWW = """"vhost:{virtualHostName}" '{
|
||||
"username": "{externalApp}",
|
||||
"documentRoot": "/home/{master}/public_html",
|
||||
"vh_root": "/home/{master}",
|
||||
"uid": {uid},
|
||||
"gid": {gid},
|
||||
"phpVersion": {php},
|
||||
"custom_conf": {
|
||||
ServerAdmin {administratorEmail}
|
||||
CustomLog /home/{master}/logs/{master}.access_log combined
|
||||
<IfModule LiteSpeed>
|
||||
CacheRoot lscache
|
||||
</IfModule>
|
||||
}
|
||||
}'"""
|
||||
|
||||
lswsRediConfChild = """"vhost:{virtualHostName}" '{
|
||||
"username": "{externalApp}",
|
||||
@@ -391,7 +405,22 @@ pm.max_spare_servers = {pmMaxSpareServers}
|
||||
"gid": {gid},
|
||||
"phpVersion": {php},
|
||||
"custom_conf": {
|
||||
ServerAlias www.{virtualHostName}
|
||||
ServerAdmin {administratorEmail}
|
||||
CustomLog /home/{masterDomain}/logs/{masterDomain}.access_log combined
|
||||
<IfModule LiteSpeed>
|
||||
CacheRoot /home/{masterDomain}/lscache
|
||||
</IfModule>
|
||||
}
|
||||
}'"""
|
||||
|
||||
lswsRediConfChildWWW = """"vhost:{virtualHostName}" '{
|
||||
"username": "{externalApp}",
|
||||
"documentRoot": "{path}",
|
||||
"vh_root": "{path}",
|
||||
"uid": {uid},
|
||||
"gid": {gid},
|
||||
"phpVersion": {php},
|
||||
"custom_conf": {
|
||||
ServerAdmin {administratorEmail}
|
||||
CustomLog /home/{masterDomain}/logs/{masterDomain}.access_log combined
|
||||
<IfModule LiteSpeed>
|
||||
|
||||
Reference in New Issue
Block a user