From 345b67a01d3ee038e4e24908d4c988156f581558 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=98=BF=E7=94=B7?= Date: Thu, 6 Apr 2023 22:03:22 +0800 Subject: [PATCH] add `proc.conf` --- conf/alchemy/proc.conf | 36 ++++++++++++++++++++++++++++++++++++ conf/alchemy/ts.conf | 7 +++---- 2 files changed, 39 insertions(+), 4 deletions(-) create mode 100644 conf/alchemy/proc.conf diff --git a/conf/alchemy/proc.conf b/conf/alchemy/proc.conf new file mode 100644 index 0000000..92b7e44 --- /dev/null +++ b/conf/alchemy/proc.conf @@ -0,0 +1,36 @@ +server { +# https://serverfault.com/questions/798734/use-variable-for-server-name-in-nginx# +# server_name $servername; + server_name "proc.alchemy-studio.cn"; + listen 443 ssl; + listen 80; + client_max_body_size 10M; + + # disable in local test env + ssl_certificate /etc/letsencrypt/live/alchemy-studio.cn/fullchain.pem; # managed by Certbot + ssl_certificate_key /etc/letsencrypt/live/alchemy-studio.cn/privkey.pem; # managed by Certbot + +; set $task_server "http://127.0.0.1:8080"; # task server host +; set $htyuc "http://127.0.0.1:3000"; #htyuc host +; set $resty_loc "/usr/local/openresty"; + + 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/proc/; + } +} + +# server { +# listen 80; +# server_name "ts.alchemy-studio.cn"; +# location / { +# return 301 https://$host$request_uri; +# } +# } \ No newline at end of file diff --git a/conf/alchemy/ts.conf b/conf/alchemy/ts.conf index 1701539..40ac49e 100644 --- a/conf/alchemy/ts.conf +++ b/conf/alchemy/ts.conf @@ -10,12 +10,11 @@ server { ssl_certificate /etc/letsencrypt/live/alchemy-studio.cn/fullchain.pem; # managed by Certbot ssl_certificate_key /etc/letsencrypt/live/alchemy-studio.cn/privkey.pem; # managed by Certbot - set $task_server "http://127.0.0.1:8080"; # task server host - set $htyuc "http://127.0.0.1:3000"; #htyuc host - set $resty_loc "/usr/local/openresty"; +; set $task_server "http://127.0.0.1:8080"; # task server host +; set $htyuc "http://127.0.0.1:3000"; #htyuc host +; set $resty_loc "/usr/local/openresty"; location /api/v1/ts/ { - 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;