parameterized
This commit is contained in:
@@ -29,5 +29,39 @@ enable log:
|
|||||||
error_log /usr/local/etc/openresty/logs/error.log;
|
error_log /usr/local/etc/openresty/logs/error.log;
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## MacOS
|
||||||
|
|
||||||
|
Binary:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
➤ which openresty 20:17:35
|
||||||
|
/usr/local/bin/openresty
|
||||||
|
```
|
||||||
|
|
||||||
|
Configuration:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
➤ pwd 20:17:57
|
||||||
|
/usr/local/opt/openresty
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
➤ pwd 20:20:00
|
||||||
|
/usr/local/opt/openresty/nginx/resty_funcs
|
||||||
|
```
|
||||||
|
|
||||||
|
Update:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
weli@ovpn-12-178:/u/l/o/o/n/resty_funcs
|
||||||
|
➤ pwd 20:20:38
|
||||||
|
/usr/local/opt/openresty/nginx/resty_funcs
|
||||||
|
weli@ovpn-12-178:/u/l/o/o/n/resty_funcs
|
||||||
|
➤ cp ~/works/resty_functions/* . 20:20:40
|
||||||
|
weli@ovpn-12-178:/u/l/o/o/n/resty_funcs
|
||||||
|
➤
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+16
-33
@@ -1,61 +1,47 @@
|
|||||||
server {
|
server {
|
||||||
server_name music-room.alchemy-studio.cn;
|
set $servername "music-room.alchemy-studio.cn";
|
||||||
|
# set $servername "localhost";
|
||||||
|
server_name $servername;
|
||||||
listen 443 ssl;
|
listen 443 ssl;
|
||||||
|
# listen 8001; # for testing, same with Vue Vite Port
|
||||||
|
|
||||||
set $tmp_file_dir "/file_upload"; # 文件存储路径
|
# 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
|
||||||
|
|
||||||
|
set $tmp_file_dir "/file_upload/"; # 文件存储路径
|
||||||
set $task_server "http://127.0.0.1:8080"; # task server host
|
set $task_server "http://127.0.0.1:8080"; # task server host
|
||||||
|
set $resty_loc "/usr/local/openresty";
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
try_files $uri $uri/ /index.html;
|
try_files $uri $uri/ /index.html;
|
||||||
proxy_set_header Host music-room.alchemy-studio.cn;
|
proxy_set_header Host $servername;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
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-Proto https;
|
||||||
proxy_set_header X-Forwarded-For $remote_addr;
|
proxy_set_header X-Forwarded-For $remote_addr;
|
||||||
proxy_set_header X-Forwarded-Host $remote_addr;
|
proxy_set_header X-Forwarded-Host $remote_addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
root /usr/local/openresty/nginx/html/music-room;
|
root $resty_loc/nginx/html/music-room;
|
||||||
index index.html;
|
index index.html;
|
||||||
|
|
||||||
location /api/ngx/test/hello_world {
|
|
||||||
#设置content type
|
|
||||||
default_type text/html ;
|
|
||||||
# HTTP Status Code 和 内容
|
|
||||||
return 200 "hello world! ";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#Upload image files
|
#Upload image files
|
||||||
location /api/ngx/image/upload {
|
location /api/ngx/image/upload {
|
||||||
content_by_lua_file /usr/local/openresty/resty_funcs/upload.lua;
|
content_by_lua_file $resty_loc/resty_funcs/upload.lua;
|
||||||
}
|
}
|
||||||
#Combine image files
|
#Combine image files
|
||||||
location /api/ngx/image/combine {
|
location /api/ngx/image/combine {
|
||||||
content_by_lua_file /usr/local/openresty/resty_funcs/combine.lua;
|
content_by_lua_file $resty_loc/resty_funcs/combine.lua;
|
||||||
}
|
}
|
||||||
#Static file server
|
#Static file server
|
||||||
location /file_upload {
|
location /file_upload {
|
||||||
default_type "";
|
default_type "";
|
||||||
alias /file_upload/;
|
alias $tmp_file_dir;
|
||||||
autoindex on;
|
autoindex on;
|
||||||
autoindex_exact_size off;
|
autoindex_exact_size off;
|
||||||
autoindex_localtime on;
|
autoindex_localtime on;
|
||||||
}
|
}
|
||||||
#Download image files
|
|
||||||
location /download_image {
|
|
||||||
rewrite_by_lua_block{
|
|
||||||
-- Get download image id
|
|
||||||
local download_image_id = string.match(ngx.var.request_uri, ".*/(.*)$")
|
|
||||||
ngx.log(ngx.INFO , "Download image id: " .. download_image_id)
|
|
||||||
|
|
||||||
-- Set redirect uri
|
|
||||||
--local uri = "/internal_file_upload/" .. download_image_id .. ".jpg"
|
|
||||||
--return ngx.exec(uri)
|
|
||||||
|
|
||||||
local uri = "/file_upload/" .. download_image_id .. ".jpg"
|
|
||||||
return ngx.exec(uri, {a = download_image_id})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
location /api/v1/ws/ {
|
location /api/v1/ws/ {
|
||||||
proxy_pass http://127.0.0.1:3001/api/v1/ws/;
|
proxy_pass http://127.0.0.1:3001/api/v1/ws/;
|
||||||
@@ -69,7 +55,4 @@ server {
|
|||||||
proxy_pass http://127.0.0.1:8080/api/v1/ts/;
|
proxy_pass http://127.0.0.1:8080/api/v1/ts/;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user