split nginx config by domain
This commit is contained in:
@@ -0,0 +1,80 @@
|
||||
server {
|
||||
# https://serverfault.com/questions/798734/use-variable-for-server-name-in-nginx#
|
||||
# server_name $servername;
|
||||
server_name "admin.huiwings.cn";
|
||||
listen 443 ssl;
|
||||
client_max_body_size 10M;
|
||||
|
||||
# disable in local test env
|
||||
ssl_certificate /etc/letsencrypt/live/huiwings.cn/fullchain.pem; # managed by Certbot
|
||||
ssl_certificate_key /etc/letsencrypt/live/huiwings.cn/privkey.pem; # managed by Certbot
|
||||
|
||||
set $tmp_file_dir "/file_upload/"; # 文件存储路径
|
||||
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 $convert "/usr/bin/convert";
|
||||
set $upyun_operator "moicen";
|
||||
set $upyun_password "NyJ51zRwFApY9Wo9EHJMrb8GI9YtvpVN";
|
||||
set $upyun_bucket "huiwing";
|
||||
set $upyun_directory "music-room";
|
||||
set $upyun_cdn "https://upyun.alchemy-studio.cn/";
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
proxy_set_header Host "admin.huiwings.cn";
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
# disable in local test env
|
||||
proxy_set_header X-Forwarded-Proto https;
|
||||
proxy_set_header X-Forwarded-For $remote_addr;
|
||||
proxy_set_header X-Forwarded-Host $remote_addr;
|
||||
}
|
||||
|
||||
root $resty_loc/nginx/html/huiwing/admin;
|
||||
index index.html;
|
||||
|
||||
add_header Access-Control-Allow-Origin $http_origin;
|
||||
add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS';
|
||||
add_header Access-Control-Allow-Headers 'Authorization,unionid,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;
|
||||
}
|
||||
|
||||
#Upload image files
|
||||
location /api/ngx/image/upload {
|
||||
content_by_lua_file $resty_loc/nginx/scripts/upload.lua;
|
||||
}
|
||||
#Combine image files
|
||||
location /api/ngx/image/combine {
|
||||
content_by_lua_file $resty_loc/nginx/scripts/combine.lua;
|
||||
}
|
||||
#Audio file download
|
||||
location /api/ngx/audio/upload {
|
||||
content_by_lua_file $resty_loc/nginx/scripts/upload_audio.lua;
|
||||
}
|
||||
#Audio file convert
|
||||
location /api/ngx/audio/convert {
|
||||
content_by_lua_file $resty_loc/nginx/scripts/convert_audio.lua;
|
||||
}
|
||||
|
||||
location /api/ngx/convert/test {
|
||||
content_by_lua_file $resty_loc/nginx/scripts/test.lua;
|
||||
}
|
||||
|
||||
location /api/v1/ws/ {
|
||||
proxy_pass http://127.0.0.1:3001/api/v1/ws/;
|
||||
}
|
||||
location /api/v1/uc/ {
|
||||
proxy_pass http://127.0.0.1:3000/api/v1/uc/;
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name "admin.huiwings.cn";
|
||||
location / {
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user