2021-11-18 20:02:01 +08:00
|
|
|
put `upload.lua` into:
|
2021-07-22 20:09:05 +08:00
|
|
|
|
2021-08-07 16:28:15 +08:00
|
|
|
```bash
|
2021-11-18 20:02:01 +08:00
|
|
|
/usr/local/opt/openresty/nginx/resty_funcs
|
2021-08-07 16:28:15 +08:00
|
|
|
```
|
|
|
|
|
|
2021-11-18 20:02:01 +08:00
|
|
|
post file:
|
2021-08-07 16:28:15 +08:00
|
|
|
|
|
|
|
|
```bash
|
2021-11-18 20:02:01 +08:00
|
|
|
$ curl --location --request POST 'localhost/upload' \
|
|
|
|
|
--form '=@"/Users/weli/works/task_server/src/test/resources/file_example_JPG_100kB.jpeg"'
|
2021-08-07 16:28:15 +08:00
|
|
|
```
|
|
|
|
|
|
2021-11-18 20:02:01 +08:00
|
|
|
nginx config
|
2021-07-22 20:09:05 +08:00
|
|
|
|
2021-08-07 16:28:15 +08:00
|
|
|
```
|
2021-11-18 20:02:01 +08:00
|
|
|
/usr/local/etc/openresty/nginx.conf
|
2021-08-08 00:13:19 +08:00
|
|
|
```
|
2021-07-22 20:09:05 +08:00
|
|
|
|
2021-08-07 16:28:15 +08:00
|
|
|
```
|
2021-11-18 20:02:01 +08:00
|
|
|
location /upload {
|
|
|
|
|
content_by_lua_file /usr/local/opt/openresty/nginx/resty_funcs/upload.lua;
|
2021-08-07 16:28:15 +08:00
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
2021-11-18 20:02:01 +08:00
|
|
|
enable log:
|
2021-08-07 16:28:15 +08:00
|
|
|
|
|
|
|
|
```
|
2021-11-18 20:02:01 +08:00
|
|
|
error_log /usr/local/etc/openresty/logs/error.log;
|
2021-08-08 18:50:54 +08:00
|
|
|
```
|
|
|
|
|
|
2021-11-18 20:45:55 +08:00
|
|
|
## 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
|
|
|
|
|
➤
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
2021-09-06 19:33:30 +08:00
|
|
|
|
|
|
|
|
|