Files
resty_functions/music-room-dev.conf
T
2021-11-28 09:59:30 +08:00

64 lines
2.1 KiB
Plaintext

server {
# set $servername "test-music-room.moicen.com";
# set $servername "localhost";
set $servername "test-music-room.moicen.com";
# https://serverfault.com/questions/798734/use-variable-for-server-name-in-nginx#
# server_name $servername;
server_name "test-music-room.moicen.com";
listen 443 ssl;
# listen 8001; # for testing, same with Vue Vite Port
# disable in local test env
ssl_certificate /etc/letsencrypt/live/test-music-room.moicen.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/test-music-room.moicen.com/privkey.pem; # managed by Certbot
set $tmp_file_dir "/file_upload/"; # 文件存储路径
set $task_server "http://127.0.0.1:8080"; # task server host
set $hty_uc_host "https://${servername}"; #htyuc host
set $resty_loc "/usr/local/openresty";
set $convert "/usr/bin/convert";
location / {
try_files $uri $uri/ /index.html;
proxy_set_header Host $servername;
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/music-room;
index index.html;
#Upload image files
location /api/ngx/image/upload {
content_by_lua_file $resty_loc/resty_funcs/upload.lua;
}
#Combine image files
location /api/ngx/image/combine {
content_by_lua_file $resty_loc/resty_funcs/combine.lua;
}
#Static file server
location /file_upload {
default_type "";
alias $tmp_file_dir;
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
}
location /api/v1/ws/ {
proxy_pass http://127.0.0.1:3001/api/v1/ws/;
proxy_set_header Host $host;
}
location /api/v1/uc/ {
proxy_pass http://127.0.0.1:3000/api/v1/uc/;
proxy_set_header Host $host;
}
location /api/v1/ts/ {
proxy_pass http://127.0.0.1:8080/api/v1/ts/;
proxy_set_header Host $host;
}
}