157bd65bc94b9e08ea0e785ad90d20388f50df4a
resty里请求域名地址时无法使用本地的/etc/hosts文件,需在nginx.conf文件中的http模块内添加resolver配置显式指定:
http {
...
resolver 8.8.8.8;
...
}
测试服所使用的DNS服务:
➤ ssh weli@moicen.com
Activate the web console with: systemctl enable --now cockpit.socket
Last login: Wed Dec 29 20:10:34 2021 from 111.193.10.152
[weli@moicen ~]$ cat /etc/resolv.conf
# Generated by NetworkManager
nameserver 183.60.82.98
nameserver 183.60.83.19
[weli@moicen ~]$
put upload.lua into:
/usr/local/opt/openresty/nginx/resty_funcs
post file:
$ 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;
MacOS
Binary:
➤ which openresty 20:17:35
/usr/local/bin/openresty
Configuration:
➤ pwd 20:17:57
/usr/local/opt/openresty
➤ pwd 20:20:00
/usr/local/opt/openresty/nginx/resty_funcs
Update:
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
➤
Pre-Install lua third module
luarocks install lua-resty-jit-uuid
luarocks install lua-resty-jwt
Description
Languages
Lua
76.4%
Shell
23.6%