add local linux scripts
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
server {
|
||||
# https://serverfault.com/questions/798734/use-variable-for-server-name-in-nginx#
|
||||
# server_name $servername;
|
||||
server_name "admin.localhost";
|
||||
listen 8088;
|
||||
client_max_body_size 10M;
|
||||
|
||||
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/local/bin/convert";
|
||||
set $upyun_operator "moicen";
|
||||
set $upyun_password "NyJ51zRwFApY9Wo9EHJMrb8GI9YtvpVN";
|
||||
set $upyun_bucket "moicen";
|
||||
set $upyun_directory "music-room";
|
||||
set $upyun_cdn "https://upyun.dev.moicen.com/";
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
proxy_set_header Host "admin.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/admin;
|
||||
index index.html;
|
||||
|
||||
add_header Access-Control-Allow-Origin $http_origin always;
|
||||
add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS' always;
|
||||
add_header Access-Control-Allow-Headers 'Authorization,unionid,HtySudoerToken,HtyHost,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type' always;
|
||||
add_header Access-Control-Allow-Credentials true always;
|
||||
add_header Access-Control-Max-Age 86400 always;
|
||||
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/;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
# 这个music-room小程序的配置本地测试目前用不上
|
||||
server {
|
||||
# https://serverfault.com/questions/798734/use-variable-for-server-name-in-nginx#
|
||||
# server_name $servername;
|
||||
server_name "music-room.localhost";
|
||||
listen 8088;
|
||||
client_max_body_size 10M;
|
||||
|
||||
set $resty_loc "/usr/local/openresty";
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
proxy_set_header Host "music-room.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;
|
||||
|
||||
|
||||
# # 公众号校验
|
||||
# location /MP_verify_Jo6pKmy43wx7S5Sh.txt {
|
||||
# return 200 'Jo6pKmy43wx7S5Sh';
|
||||
# }
|
||||
#
|
||||
# # 小程序业务域名校验
|
||||
# location /Q25f8xC3Jo.txt {
|
||||
# return 200 '323072b225a694281cd23496fa6737ef';
|
||||
# }
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
server {
|
||||
# https://serverfault.com/questions/798734/use-variable-for-server-name-in-nginx#
|
||||
# server_name $servername;
|
||||
server_name "ts.localhost";
|
||||
listen 8088;
|
||||
client_max_body_size 10M;
|
||||
|
||||
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";
|
||||
|
||||
location /api/v1/ts/ {
|
||||
add_header Access-Control-Allow-Origin $http_origin always;
|
||||
add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS' always;
|
||||
add_header Access-Control-Allow-Headers 'Authorization,HtyAdminToken,HtySudoerToken,HtyHost,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type' always;
|
||||
add_header Access-Control-Allow-Credentials true always;
|
||||
add_header Access-Control-Max-Age 86400 always;
|
||||
if ($request_method = 'OPTIONS') {
|
||||
return 200;
|
||||
}
|
||||
proxy_pass http://127.0.0.1:8080/api/v1/ts/;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
#!/bin/sh
|
||||
set -x
|
||||
|
||||
# Openresty config
|
||||
|
||||
# -- Get openresty config path
|
||||
openresty_sub_config_dir='/usr/local/openresty/nginx/conf.d'
|
||||
echo $openresty_sub_config_dir
|
||||
|
||||
# -- Make sub config dir
|
||||
mkdir -p $openresty_sub_config_dir
|
||||
# -- Copy sun config file
|
||||
cp conf/local_linux/*.conf $openresty_sub_config_dir
|
||||
|
||||
|
||||
# Lua scripts
|
||||
|
||||
# -- Get openresty install path
|
||||
openresty_lua_scripts_dir='/usr/local/openresty/nginx/scripts'
|
||||
echo $openresty_lua_scripts_dir
|
||||
# -- Make scripts dir
|
||||
mkdir -p $openresty_lua_scripts_dir
|
||||
# -- Copy scripts file
|
||||
cp scripts/*.lua $openresty_lua_scripts_dir
|
||||
# -- Replace scripts path in file
|
||||
sed -i -e "s|<SCRIPT_PATH>|$openresty_lua_scripts_dir|" \
|
||||
"$openresty_lua_scripts_dir"/combine.lua \
|
||||
"$openresty_lua_scripts_dir"/convert_audio.lua \
|
||||
"$openresty_lua_scripts_dir"/test_upyun_upload.lua \
|
||||
"$openresty_lua_scripts_dir"/upyun_upload.lua
|
||||
|
||||
# Reload openresty
|
||||
openresty -t
|
||||
openresty -s reload
|
||||
Reference in New Issue
Block a user