2021-09-04 12:38:15 +08:00
|
|
|
server {
|
2021-11-28 09:59:30 +08:00
|
|
|
# https://serverfault.com/questions/798734/use-variable-for-server-name-in-nginx#
|
|
|
|
|
# server_name $servername;
|
|
|
|
|
server_name "test-music-room.moicen.com";
|
2021-09-04 12:38:15 +08:00
|
|
|
listen 443 ssl;
|
|
|
|
|
|
2021-11-18 20:45:55 +08:00
|
|
|
# disable in local test env
|
2021-11-28 09:18:49 +08:00
|
|
|
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
|
2021-11-18 20:45:55 +08:00
|
|
|
|
|
|
|
|
set $tmp_file_dir "/file_upload/"; # 文件存储路径
|
2021-11-28 16:29:59 +08:00
|
|
|
set $task_server "http://127.0.0.1:8080"; # task server host
|
|
|
|
|
set $htyuc "http://127.0.0.1:3000"; #htyuc host
|
2021-11-18 20:45:55 +08:00
|
|
|
set $resty_loc "/usr/local/openresty";
|
2021-11-28 09:30:52 +08:00
|
|
|
set $convert "/usr/bin/convert";
|
2021-09-04 12:38:15 +08:00
|
|
|
|
|
|
|
|
location / {
|
|
|
|
|
try_files $uri $uri/ /index.html;
|
2021-11-28 10:11:21 +08:00
|
|
|
proxy_set_header Host "test-music-room.moicen.com";
|
2021-09-04 12:38:15 +08:00
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
2021-11-18 20:45:55 +08:00
|
|
|
# disable in local test env
|
2021-09-04 12:38:15 +08:00
|
|
|
proxy_set_header X-Forwarded-Proto https;
|
|
|
|
|
proxy_set_header X-Forwarded-For $remote_addr;
|
|
|
|
|
proxy_set_header X-Forwarded-Host $remote_addr;
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-18 20:45:55 +08:00
|
|
|
root $resty_loc/nginx/html/music-room;
|
2021-09-04 12:38:15 +08:00
|
|
|
index index.html;
|
|
|
|
|
|
|
|
|
|
#Upload image files
|
|
|
|
|
location /api/ngx/image/upload {
|
2021-11-18 20:45:55 +08:00
|
|
|
content_by_lua_file $resty_loc/resty_funcs/upload.lua;
|
2021-09-04 12:38:15 +08:00
|
|
|
}
|
|
|
|
|
#Combine image files
|
|
|
|
|
location /api/ngx/image/combine {
|
2021-11-18 20:45:55 +08:00
|
|
|
content_by_lua_file $resty_loc/resty_funcs/combine.lua;
|
2021-09-04 12:38:15 +08:00
|
|
|
}
|
2021-09-06 19:33:30 +08:00
|
|
|
#Static file server
|
|
|
|
|
location /file_upload {
|
|
|
|
|
default_type "";
|
2021-11-18 20:45:55 +08:00
|
|
|
alias $tmp_file_dir;
|
2021-09-06 19:33:30 +08:00
|
|
|
autoindex on;
|
|
|
|
|
autoindex_exact_size off;
|
|
|
|
|
autoindex_localtime on;
|
|
|
|
|
}
|
2021-09-04 12:38:15 +08:00
|
|
|
|
|
|
|
|
location /api/v1/ws/ {
|
|
|
|
|
proxy_pass http://127.0.0.1:3001/api/v1/ws/;
|
2021-11-28 10:11:21 +08:00
|
|
|
proxy_set_header Host "test-music-room.moicen.com";
|
2021-09-04 12:38:15 +08:00
|
|
|
}
|
|
|
|
|
location /api/v1/uc/ {
|
|
|
|
|
proxy_pass http://127.0.0.1:3000/api/v1/uc/;
|
2021-11-28 10:11:21 +08:00
|
|
|
proxy_set_header Host "test-music-room.moicen.com";
|
2021-09-04 12:38:15 +08:00
|
|
|
}
|
|
|
|
|
location /api/v1/ts/ {
|
|
|
|
|
proxy_pass http://127.0.0.1:8080/api/v1/ts/;
|
2021-11-28 10:11:21 +08:00
|
|
|
proxy_set_header Host "test-music-room.moicen.com";
|
2021-09-04 12:38:15 +08:00
|
|
|
}
|
|
|
|
|
}
|
2021-11-28 10:09:52 +08:00
|
|
|
|
|
|
|
|
server {
|
|
|
|
|
listen 80;
|
2021-11-28 11:09:36 +08:00
|
|
|
server_name "test-music-room.moicen.com";
|
2021-11-28 10:09:52 +08:00
|
|
|
location / {
|
|
|
|
|
return 301 https://$host$request_uri;
|
|
|
|
|
}
|
|
|
|
|
}
|