split nginx config by domain

This commit is contained in:
moicen
2022-02-01 22:27:42 +08:00
committed by 木逸辰
parent af7b91674e
commit a1a3c17a21
9 changed files with 322 additions and 13 deletions
+37
View File
@@ -0,0 +1,37 @@
server {
# https://serverfault.com/questions/798734/use-variable-for-server-name-in-nginx#
# server_name $servername;
server_name "ts.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/ts/ {
add_header Access-Control-Allow-Origin $http_origin;
add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS';
add_header Access-Control-Allow-Headers 'Authorization,HtyAdminToken,HtySudoerToken,HtyHost,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
add_header Access-Control-Allow-Credentials true;
add_header Access-Control-Max-Age 86400;
if ($request_method = 'OPTIONS') {
return 200;
}
proxy_pass http://127.0.0.1:8080/api/v1/ts/;
}
}
# server {
# listen 80;
# server_name "ts.alchemy-studio.cn";
# location / {
# return 301 https://$host$request_uri;
# }
# }