Files
resty_functions/music-room-test.conf
T

101 lines
2.8 KiB
Plaintext
Raw Normal View History

2021-11-19 10:59:37 +08:00
# MacOS:
#
# ➤ brew install openresty/brew/openresty
#
# EXEC:
#
# ➤ which openresty
# /usr/local/bin/openresty
#
# Config:
#
# ➤ ls /usr/local/etc/openresty
# fastcgi.conf nginx.conf
# fastcgi.conf.default nginx.conf.default
# fastcgi_params scgi_params
# fastcgi_params.default scgi_params.default
# koi-utf uwsgi_params
# koi-win uwsgi_params.default
# mime.types win-utf
# mime.types.default
#
# Main:
#
# ➤ ls /usr/local/opt/openresty
# COPYRIGHT
# INSTALL_RECEIPT.json
# README.markdown
# bin
# homebrew.mxcl.openresty.plist
# luajit
# lualib
# nginx
# pod
# resty.index
# site
2021-11-18 20:46:09 +08:00
server {
2021-11-28 09:59:30 +08:00
server_name "test.localhost";
2021-11-19 20:26:29 +08:00
listen 8088;
2021-11-18 20:46:09 +08:00
# disable in local test env
# ssl_certificate /etc/letsencrypt/live/music-room.alchemy-studio.cn/fullchain.pem; # managed by Certbot
# ssl_certificate_key /etc/letsencrypt/live/music-room.alchemy-studio.cn/privkey.pem; # managed by Certbot
2021-11-19 10:59:37 +08:00
# https://fishshell.com/docs/current/language.html#variable-expansion
# ➤ mkdir -p /usr/local/file_upload
# ➤ sudo chown (whoami) /usr/local/file_upload
set $tmp_file_dir "/usr/local/file_upload"; # 文件存储路径
2021-11-28 15:22:28 +08:00
set $task_server "http://127.0.0.1:8080"; # task server host
2021-11-28 15:40:07 +08:00
set $htyuc "http://127.0.0.1:3000"; #htyuc host
2021-11-19 10:59:37 +08:00
set $resty_loc "/usr/local/opt/openresty"; # MacOS
2021-11-20 03:51:39 +08:00
set $convert "/usr/local/bin/convert";
2021-11-18 20:46:09 +08:00
location / {
try_files $uri $uri/ /index.html;
2021-11-28 15:22:28 +08:00
proxy_set_header Host "test.localhost";
2021-11-18 20:46:09 +08:00
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;
}
#Audio file convert
location /api/ngx/audio/convert {
content_by_lua_file $resty_loc/resty_funcs/audio_convert.lua;
}
2021-11-18 20:46:09 +08:00
#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/;
2021-11-28 14:46:40 +08:00
proxy_set_header Host $host;
2021-11-18 20:46:09 +08:00
}
location /api/v1/uc/ {
proxy_pass http://127.0.0.1:3000/api/v1/uc/;
2021-11-28 14:46:40 +08:00
proxy_set_header Host $host;
2021-11-18 20:46:09 +08:00
}
location /api/v1/ts/ {
proxy_pass http://127.0.0.1:8080/api/v1/ts/;
proxy_set_header Host $host;
}
}