105 lines
2.9 KiB
Plaintext
105 lines
2.9 KiB
Plaintext
# 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
|
|
server {
|
|
server_name "test.localhost";
|
|
listen 8088;
|
|
|
|
# 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
|
|
|
|
# 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"; # 文件存储路径
|
|
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/opt/openresty"; # MacOS
|
|
set $convert "/usr/local/bin/convert";
|
|
|
|
location / {
|
|
try_files $uri $uri/ /index.html;
|
|
proxy_set_header Host "test.localhost";
|
|
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 download
|
|
location /api/ngx/audio/upload {
|
|
content_by_lua_file $resty_loc/resty_funcs/upload_audio.lua;
|
|
}
|
|
#Audio file convert
|
|
location /api/ngx/audio/convert {
|
|
content_by_lua_file $resty_loc/resty_funcs/covnert_audio.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;
|
|
}
|
|
}
|