bug fix: apache manager and resolve some ports conflicts

This commit is contained in:
usman@cyberpersons.com
2023-05-17 19:19:30 +05:00
parent 08ce5b6276
commit ebc70fdf6d
3 changed files with 17 additions and 9 deletions

View File

@@ -128,17 +128,22 @@ LoadModule mpm_event_module modules/mod_mpm_event.so
confPath = ApacheVhost.serverRootPath + "/conf/httpd.conf"
CurrentConf = open(confPath, 'r').read()
data = open(confPath, 'r').readlines()
writeToFile = open(confPath, 'w')
for items in data:
if items.find("Listen") > -1 and items.find("80") > -1 and items.find('#') == -1:
writeToFile.writelines("Listen 8081\nListen 8082\n")
if CurrentConf.find('Listen 8083') ==-1:
writeToFile.writelines("Listen 8083\nListen 8082\n")
elif items.find("User") > -1 and items.find('#') == -1:
writeToFile.writelines("User nobody\n")
if CurrentConf.find('User nobody') == -1:
writeToFile.writelines("User nobody\n")
elif items.find("Group") > -1 and items.find('#') == -1:
writeToFile.writelines("Group nobody\n")
writeToFile.writelines('SetEnv LSWS_EDITION Openlitespeed\nSetEnv X-LSCACHE on\n')
if CurrentConf.find('Group nobody') == -1:
writeToFile.writelines("Group nobody\n")
writeToFile.writelines('SetEnv LSWS_EDITION Openlitespeed\nSetEnv X-LSCACHE on\n')
elif items[0] == "#":
continue
else:
@@ -160,7 +165,7 @@ LoadModule mpm_event_module modules/mod_mpm_event.so
portsPath = '/etc/apache2/ports.conf'
WriteToFile = open(portsPath, 'w')
WriteToFile.write('Listen 8081\nListen 8082\n')
WriteToFile.write('Listen 8083\nListen 8082\n')
WriteToFile.close()