1.ssl跳转优化
2.acme安装
This commit is contained in:
Mr Chen
2019-03-05 12:59:37 +08:00
parent ef856a1420
commit 0c05f87acd
3 changed files with 11 additions and 9 deletions
+8 -8
View File
@@ -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, '站点删除成功!')
+1 -1
View File
@@ -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){
+2
View File
@@ -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