From 91debbbee1724a2bc3a05f38dc701ce14734e260 Mon Sep 17 00:00:00 2001 From: midoks Date: Sun, 7 Aug 2022 21:38:44 +0800 Subject: [PATCH] ip --- class/core/mw.py | 7 ++++++- class/core/site_api.py | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/class/core/mw.py b/class/core/mw.py index d2e694633..70141afea 100755 --- a/class/core/mw.py +++ b/class/core/mw.py @@ -98,7 +98,12 @@ def systemdCfgDir(): return cfg_dir # debian,centos - return "/usr/lib/systemd/system" + cfg_dir = '/usr/lib/systemd/system' + if os.path.exists(cfg_dir): + return cfg_dir + + # local test + return "/tmp" def getOs(): diff --git a/class/core/site_api.py b/class/core/site_api.py index c1b49c174..ad597ada0 100755 --- a/class/core/site_api.py +++ b/class/core/site_api.py @@ -730,11 +730,11 @@ class site_api: if conf.find('ssl_certificate') == -1: return mw.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) mw.writeFile(file, conf)