Created
May 9, 2017 23:42
-
-
Save zhangchunlin/1570870daaa77a83f6e833b8c4312268 to your computer and use it in GitHub Desktop.
nginx.conf , openresty, redirect, ip
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
怎么不用capture