From 022909f91e1be4be0f4c7502cacc8d42d5b5a34d Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Tue, 5 Mar 2019 12:59:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1.ssl跳转优化 2.acme安装 --- class/core/site_api.py | 16 ++++++++-------- route/static/app/site.js | 2 +- scripts/install_centos.sh | 2 ++ 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/class/core/site_api.py b/class/core/site_api.py index 74d0ac347..4cf10d994 100755 --- a/class/core/site_api.py +++ b/class/core/site_api.py @@ -659,19 +659,19 @@ class site_api: file = self.getHostConf(siteName) conf = public.readFile(file) if conf: - if conf.find('ssl_certificate') == -1: - return public.returnJson(False, '当前未开启SSL') + # if conf.find('ssl_certificate') == -1: + # return public.returnJson(False, '当前未开启SSL') to = """#error_page 404/404.html; - # HTTP_TO_HTTPS_START + #HTTP_TO_HTTPS_START if ($server_port !~ 443){ rewrite ^(/.*)$ https://$host$1 permanent; } - # HTTP_TO_HTTPS_END""" + #HTTP_TO_HTTPS_END""" conf = conf.replace('#error_page 404/404.html;', to) public.writeFile(file, conf) public.restartWeb() - return public.returnJson(True, '设置成功!') + return public.returnJson(True, '设置成功!证书也要设置好哟!') def closeToHttpsApi(self): siteName = request.form.get('siteName', '').encode('utf-8') @@ -685,7 +685,7 @@ class site_api: public.writeFile(file, conf) public.restartWeb() - return public.returnJson(True, '设置成功!') + return public.returnJson(True, '关闭HTTPS跳转成功!') def getIndexApi(self): sid = request.form.get('id', '').encode('utf-8') @@ -819,7 +819,7 @@ class site_api: public.restartWeb() msg = public.getInfo('网站[{1}]添加域名[{2}]成功!', (webname, domain_name)) - public.writeLog('TYPE_SITE', msg) + public.writeLog('网站管理', msg) public.M('domain').add('pid,name,port,addtime', (pid, domain_name, domain_port, public.getDate())) @@ -1118,7 +1118,7 @@ class site_api: public.M('domain').where("id=?", (find['id'],)).delete() msg = public.getInfo('网站[{1}]删除域名[{2}]成功!', (webname, domain)) - public.writeLog('TYPE_SITE', msg) + public.writeLog('网站管理', msg) public.restartWeb() return public.returnJson(True, '站点删除成功!') diff --git a/route/static/app/site.js b/route/static/app/site.js index 73d1706a8..1885389be 100755 --- a/route/static/app/site.js +++ b/route/static/app/site.js @@ -1600,7 +1600,7 @@ function closeSSLHTML(txt,siteName){ //设置httpToHttps function httpToHttps(siteName){ - var isHttps = $("#toHttps").attr('checked'); + var isHttps = $("#toHttps").prop('checked'); if(isHttps){ layer.confirm('关闭强制HTTPS后需要清空浏览器缓存才能看到效果,继续吗?',{icon:3,title:"关闭强制HTTPS"},function(){ $.post('/site/close_to_https','siteName='+siteName,function(rdata){ diff --git a/scripts/install_centos.sh b/scripts/install_centos.sh index 46bad7b1e..8b1b014fd 100755 --- a/scripts/install_centos.sh +++ b/scripts/install_centos.sh @@ -15,6 +15,8 @@ if [ ! -f /usr/bin/applydeltarpm ];then yum -y install deltarpm fi +#https need +curl https://get.acme.sh | sh if [ -f "/etc/init.d/iptables" ];then