34 lines
492 B
Markdown
34 lines
492 B
Markdown
|
|
put `upload.lua` into:
|
||
|
|
|
||
|
|
```bash
|
||
|
|
/usr/local/opt/openresty/nginx/resty_funcs
|
||
|
|
```
|
||
|
|
|
||
|
|
post file:
|
||
|
|
|
||
|
|
```bash
|
||
|
|
$ curl --location --request POST 'localhost/upload' \
|
||
|
|
--form '=@"/Users/weli/works/task_server/src/test/resources/file_example_JPG_100kB.jpeg"'
|
||
|
|
```
|
||
|
|
|
||
|
|
nginx config
|
||
|
|
|
||
|
|
```
|
||
|
|
/usr/local/etc/openresty/nginx.conf
|
||
|
|
```
|
||
|
|
|
||
|
|
```
|
||
|
|
location /upload {
|
||
|
|
content_by_lua_file /usr/local/opt/openresty/nginx/resty_funcs/upload.lua;
|
||
|
|
}
|
||
|
|
```
|
||
|
|
|
||
|
|
enable log:
|
||
|
|
|
||
|
|
```
|
||
|
|
error_log /usr/local/etc/openresty/logs/error.log;
|
||
|
|
```
|
||
|
|
|
||
|
|
|
||
|
|
|