You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# > /etc/nginx/conf.d/gee.conf
server {
listen 80;
server_name gee.nsa.info *.nsa.info;# allow large uploads of files - refer to nginx documentation# client_max_body_size 1G;# optimize downloading files larger than 1G - refer to nginx doc before adjusting# proxy_max_temp_file_size 2G;# # [Optional] Enable HTTP Strict Transport Security# # HSTS is a feature improving protection against MITM attacks# # For more information see: https://www.nginx.com/blog/http-strict-transport-security-hsts-and-nginx/#add_header Strict-Transport-Security "max-age=31536000";#auth_basic "Protected Elasticsearch";#auth_basic_user_file es_passwords;
location /lua {
#access_by_lua_file 'authorize.lua';
default_type 'text/html';
content_by_lua "ngx.say('Hello World')";
}
location /nginx_var {
# MIME type determined by default_type:
default_type 'text/plain';# try access /nginx_var?a=hello,world
content_by_lua_block {
ngx.say(ngx.var.arg_a)
}
}
location = /request_body {
# nginx: [warn] client_max_body_size 51200 should be greater than total postpone buffer size 65536 in /etc/nginx/nginx.conf:170# client_max_body_size 50k;
client_body_buffer_size 50k;
content_by_lua_block {
ngx.req.read_body() -- explicitly read the req body
local data = ngx.req.get_body_data()
if data then
ngx.say("body data:")
ngx.print(data)
return
end
-- body may get buffered in a temp file:
local file = ngx.req.get_body_file()
if file then
ngx.say("body is in file ", file)
else
ngx.say("no body found")
end
}
}
}
6. 测试运行状况:
echo"export PATH=$PATH:/usr/local/openresty/bin">> /etc/profile
source /etc/profile
nginx -v
# Tengine version: Tengine/2.3.2# nginx version: nginx/1.17.3
nginx -t
# nginx: the configuration file /etc/nginx/nginx.conf syntax is ok# nginx: configuration file /etc/nginx/nginx.conf test is successful# or
openresty -t
# nginx: the configuration file /etc/nginx/nginx.conf syntax is ok# nginx: configuration file /etc/nginx/nginx.conf test is successful# start
nginx
curl gee.nsa.info/lua -x 127.0.0.1:80
# Hello World
curl gee.nsa.info/nginx_var?a=hello,world -x 127.0.0.1:80
# hello,world# 更高级地测试# cd ..# git clone https://github.com/totemofwolf/lua-resty-redis-ratelimit.git# cd lua-resty-redis-ratelimit/# make install DESTDIR= LUA_LIB_DIR=/usr/local/openresty/lualib# ...
The text was updated successfully, but these errors were encountered:
非常感谢 @totemofwolf 的安装步骤信息。
Tengine + openresty, here are the compiling steps:
1. 获取依赖包:
2. 魔改:
3. 修改openresty-1.15.8.2/configure文件:
4. 编译安装:
特别地,如果你的宿主机是Mac,你可以将上面的3步骤在宿主机上执行,然后进行以下操作拷贝包到容器:
5. 配置文件
6. 测试运行状况:
The text was updated successfully, but these errors were encountered: