nginx proxy_redirect 的用法
来源:互联网 发布:同步带传动设计软件 编辑:程序博客网 时间:2024/06/07 04:37
proxy_redirect
语法:proxy_redirect [ default|off|redirect replacement ]
默认值:proxy_redirect default
使用字段:http, server, location
如果需要修改从被代理服务器传来的应答头中的"Location"和"Refresh"字段,可以用这个指令设置。
假设被代理服务器返回Location字段为: http://localhost:8000/two/some/uri/
这个指令:proxy_redirect http://localhost:8000/two/ http://frontend/one/;
将Location字段重写为http://frontend/one/some/uri/。
在代替的字段中可以不写服务器名:
proxy_redirect http://localhost:8000/two/ /;
这样就使用服务器的基本名称和端口,即使它来自非80端口。
如果使用“default”参数,将根据location和proxy_pass参数的设置来决定。
例如下列两个配置等效:
location /one/ {
proxy_pass http://upstream:port/two/;
proxy_redirect default;
}
location /one/ {
proxy_pass http://upstream:port/two/;
proxy_redirect http://upstream:port/two/ /one/;
}
在指令中可以使用一些变量:
proxy_redirect http://localhost:8000/ http://$host:$server_port/;
这个指令有时可以重复:
proxy_redirect default;
proxy_redirect http://localhost:8000/ /;
proxy_redirect http://www.example.com/ /;
参数off将在这个字段中禁止所有的proxy_redirect指令:
proxy_redirect off;
proxy_redirect default;
proxy_redirect http://localhost:8000/ /;
proxy_redirect http://www.example.com/ /;
利用这个指令可以为被代理服务器发出的相对重定向增加主机名:proxy_redirect / /;
http://www.ruby-forum.com/topic/131560
***********************************
location ~ .*\.(gif|jpg|jpeg|png|swf|flv|bmp)$ {
valid_referers none blocked *.anfun8.com anfun8.com;
if ($invalid_referer) {
rewrite ^/(.*)$ http://imgcache.qq.com/ac/qzone_v5/app/photo/sysbussy.jpg permanent;
}
proxy_pass http://upstream:port/two/;
proxy_redirect default;
}
location /one/ {
proxy_pass http://upstream:port/two/;
proxy_redirect http://upstream:port/two/ /one/;
}
proxy_redirect http://localhost:8000/ /;
proxy_redirect http://www.example.com/ /;
proxy_redirect default;
proxy_redirect http://localhost:8000/ /;
proxy_redirect http://www.example.com/ /;
http://www.ruby-forum.com/topic/131560
***********************************
location ~ .*\.(gif|jpg|jpeg|png|swf|flv|bmp)$ {
valid_referers none blocked *.anfun8.com anfun8.com;
if ($invalid_referer) {
rewrite ^/(.*)$ http://imgcache.qq.com/ac/qzone_v5/app/photo/sysbussy.jpg permanent;
}
0 0
- nginx proxy_redirect 的用法
- Nginx的proxy_redirect作用
- nginx配置中proxy_redirect的作用(转)
- nginx配置中proxy_redirect的作用(转)
- nginx配备中proxy_redirect的作用(转)
- nginx配置中proxy_redirect的作用(转)
- 关于nginx参数proxy_redirect的设置
- Nginx之proxy_redirect详解
- nginx 之 proxy_redirect详解
- nginx做反向代理proxy_pass,proxy_redirect的使用
- nginx 反向代理设置中的proxy_redirect
- nginx 负载均衡配置以及用proxy_redirect替换URL
- nginx的location用法
- nginx的常用用法
- nginx 的location 的用法
- nginx try_files用法 及Nginx location的一些配置
- nginx try_files用法 及Nginx location的一些配置
- nginx try_files用法 及Nginx location的一些配置
- JavaWeb -- Struts2 构建视图:标签和结果, UI组件标签
- QString与QByteArray相互转换方法
- 多行数据插入,使用临时表
- Mercurial(hg) 代码库迁移到 Git
- 生命的思索
- nginx proxy_redirect 的用法
- android中DisplayMetrics类的作用
- struts2+spring+ibatis框架整合
- cocos2d-x中注意加retain的地方
- Visual Studio 2012开发Windows Phone 8 App遇到的located assembly's manifest definition does not match 的问题
- strassen矩阵乘法
- px、dp和sp,这些单位有什么区别?
- 程序员的悲与喜,你知道多少
- 多边形检测区域的缩放