From faed3adfd34d67d900cff4944f70db0d6fa03eaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=98=BF=E7=94=B7?= Date: Sun, 9 Apr 2023 16:27:14 +0800 Subject: [PATCH] add proc config to resty --- conf/moicen/proc.conf | 22 ++++++++++++++++++++++ cp_scripts_alchemy.sh | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 conf/moicen/proc.conf diff --git a/conf/moicen/proc.conf b/conf/moicen/proc.conf new file mode 100644 index 0000000..7272f14 --- /dev/null +++ b/conf/moicen/proc.conf @@ -0,0 +1,22 @@ +server { + server_name "proc.moicen.com"; + listen 443 ssl; + listen 80; + client_max_body_size 10M; + + # disable in local test env + ssl_certificate /etc/letsencrypt/live/moicen.com/fullchain.pem; # managed by Certbot + ssl_certificate_key /etc/letsencrypt/live/moicen.com/privkey.pem; # managed by Certbot + + location /api/v1/proc/ { + add_header Access-Control-Allow-Origin $http_origin always; + add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS' always; + add_header Access-Control-Allow-Headers 'Authorization,HtyAdminToken,HtySudoerToken,HtyHost,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type' always; + add_header Access-Control-Allow-Credentials true always; + add_header Access-Control-Max-Age 86400 always; + if ($request_method = 'OPTIONS') { + return 200; + } + proxy_pass http://127.0.0.1:8880/api/v1/ts/; + } +} diff --git a/cp_scripts_alchemy.sh b/cp_scripts_alchemy.sh index 4fa9c2f..2073c02 100755 --- a/cp_scripts_alchemy.sh +++ b/cp_scripts_alchemy.sh @@ -24,7 +24,7 @@ mkdir -p $openresty_lua_scripts_dir cp -rv scripts/* $openresty_lua_scripts_dir # -- Replace scripts path in file sed -i -e "s||$openresty_lua_scripts_dir|g" \ - "$openresty_lua_scripts_dir"/*.lua \ + "$openresty_lua_scripts_dir"/*.lua \ "$openresty_lua_scripts_dir"/lib/*.lua \ # Reload openresty