This commit is contained in:
quackerd 2021-02-01 01:15:10 -05:00
parent f1672986c4
commit a830c4e80c
Signed by: d
GPG Key ID: F73412644EDE357A
2 changed files with 14 additions and 12 deletions

View File

@ -16,7 +16,7 @@ SERVER_IN = "server.in"
SERVER_PATH = "xray"
SERVER_FN = "config.json"
NGINX_IN = "nginx.in"
NGINX_PATH = "nginx"
NGINX_PATH = "nginx/nginx/site-confs"
NGINX_FN = "default"
CLIENT_OBJ_IN = "client_obj.in"
CLIENT_CONF_IN = "client_conf.in"
@ -132,7 +132,16 @@ def main():
with open(path, "w") as f:
f.write(template.render(template_dict))
# generate v2ray conf
# generate NGINX conf
with open(NGINX_IN, "r") as f:
template = jinja2.Template(f.read())
path = os.path.join(OUTPUT_DIR, NGINX_PATH)
os.makedirs(path, exist_ok=True)
path = os.path.join(path, NGINX_FN)
with open(path, "w") as f:
f.write(template.render(template_dict))
# generate xray conf
with open(SERVER_IN, "r") as f:
template = jinja2.Template(f.read())
path = os.path.join(OUTPUT_DIR, SERVER_PATH)

View File

@ -1,14 +1,7 @@
server {
listen 80 default_server;
server_name {{ subdomain }}.{{ domain }};
if ($remote_addr = 127.0.0.1) {
root /config/www;
index index.html index.htm index.php;
}
if ($remote_addr != 127.0.0.1) {
return 301 https://$host$request_uri;
}
server_name {{subdomain}}.{{domain}};
root /config/www;
index index.html index.htm index.php;
}