Skip to content

Instantly share code, notes, and snippets.

@zhangchunlin
Created May 9, 2017 23:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zhangchunlin/1570870daaa77a83f6e833b8c4312268 to your computer and use it in GitHub Desktop.
Save zhangchunlin/1570870daaa77a83f6e833b8c4312268 to your computer and use it in GitHub Desktop.
nginx.conf , openresty, redirect, ip
worker_processes 1;
error_log logs/error.log;
events {
worker_connections 1024;
}
http {
server {
listen 6699;
location / {
default_type text/html;
content_by_lua_block {
ngx.say("Hello World")
}
}
location /test {
default_type text/html;
content_by_lua_block {
if ngx.var.remote_addr == "192.168.1.108" then
ngx.say("hello from upstream,".."from "..ngx.var.remote_addr..",uri:"..ngx.var.uri)
else
return ngx.redirect("/test2");
end
}
}
location /test2 {
default_type text/html;
content_by_lua_block {
ngx.say("hello from test2,".."from "..ngx.var.remote_addr..",uri:"..ngx.var.uri)
}
}
}
}
@noname007
Copy link

怎么不用capture

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment