|
@ -1284,6 +1284,10 @@ def renewLetsEncrypt(self, ee_domain_name): |
|
|
#redirect= False to disable https redirection |
|
|
#redirect= False to disable https redirection |
|
|
def httpsRedirect(self,ee_domain_name,redirect=True): |
|
|
def httpsRedirect(self,ee_domain_name,redirect=True): |
|
|
if redirect: |
|
|
if redirect: |
|
|
|
|
|
if os.path.isfile("/etc/nginx/conf.d/force-ssl-{0}.conf.disabled".format(ee_domain_name)): |
|
|
|
|
|
EEFileUtils.mvfile(self, "/etc/nginx/conf.d/force-ssl-{0}.conf.disabled".format(ee_domain_name), |
|
|
|
|
|
"/etc/nginx/conf.d/force-ssl-{0}.conf".format(ee_domain_name)) |
|
|
|
|
|
else: |
|
|
try: |
|
|
try: |
|
|
Log.info(self, "Adding /etc/nginx/conf.d/force-ssl-{0}.conf".format(ee_domain_name)) |
|
|
Log.info(self, "Adding /etc/nginx/conf.d/force-ssl-{0}.conf".format(ee_domain_name)) |
|
|
|
|
|
|
|
@ -1298,12 +1302,21 @@ def httpsRedirect(self,ee_domain_name,redirect=True): |
|
|
.format(ee_domain_name)) |
|
|
.format(ee_domain_name)) |
|
|
sslconf.close() |
|
|
sslconf.close() |
|
|
# Nginx Configation into GIT |
|
|
# Nginx Configation into GIT |
|
|
EEGit.add(self, |
|
|
|
|
|
["/etc/nginx"], msg="Adding /etc/nginx/conf.d/force-ssl-{0}.conf".format(ee_domain_name)) |
|
|
|
|
|
except IOError as e: |
|
|
except IOError as e: |
|
|
Log.debug(self, str(e)) |
|
|
Log.debug(self, str(e)) |
|
|
Log.debug(self, "Error occured while generating " |
|
|
Log.debug(self, "Error occured while generating " |
|
|
"/etc/nginx/conf.d/force-ssl-{0}.conf".format(ee_domain_name)) |
|
|
"/etc/nginx/conf.d/force-ssl-{0}.conf".format(ee_domain_name)) |
|
|
|
|
|
EEGit.add(self, |
|
|
|
|
|
["/etc/nginx"], msg="Adding /etc/nginx/conf.d/force-ssl-{0}.conf".format(ee_domain_name)) |
|
|
|
|
|
else: |
|
|
|
|
|
if os.path.isfile("/etc/nginx/conf.d/force-ssl-{0}.conf".format(ee_domain_name)): |
|
|
|
|
|
EEFileUtils.mvfile(self, "/etc/nginx/conf.d/force-ssl-{0}.conf".format(ee_domain_name), |
|
|
|
|
|
"/etc/nginx/conf.d/force-ssl-{0}.conf.disabled".format(ee_domain_name)) |
|
|
|
|
|
if not EEService.reload_service(self, 'nginx'): |
|
|
|
|
|
Log.error(self, "service nginx reload failed. " |
|
|
|
|
|
"check issues with `nginx -t` command") |
|
|
|
|
|
Log.info(self, "Successfully Disabled HTTPS Force Redirection for Site " |
|
|
|
|
|
" http://{0}".format(ee_domain_name)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|