免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1695 | 回复: 3
打印 上一主题 下一主题

[Web] nginx return 的问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2013-12-09 18:17 |只看该作者 |倒序浏览
使用
location ~* admin {
return 200 http://192.168.1.200/error.html;
}
使用这个配置为什么访问时会变成下载页
且下载后查看里面的内容是http://192.168.1.200/error.html
return
Syntax:        return code [ text ]
return code URL
return URL
Default:       
Context:         server
location
if
Reference:        return

This directive concludes execution of the rules and returns the status code indicated to client. It is possible to use any http return code, ranging in number from 0-999. Furthermore, nonstandard code 444 closes the connection without sending any headers.

哪里不对

论坛徽章:
0
2 [报告]
发表于 2013-12-10 10:19 |只看该作者
大神来来来来

论坛徽章:
0
3 [报告]
发表于 2013-12-10 10:58 |只看该作者
现在下载页的问题解决了,是因为使用了nginx 默认的default_type default_type  application/octet-stream;
改成default_type text/html;就可以了
但是在
return 200 http://192.168.1.200/error.html;  
这样设置后,并不能达到跳转到指定error.html上
求解决

论坛徽章:
0
4 [报告]
发表于 2013-12-10 19:40 |只看该作者
还没怎么用过return,我一般都是proxy_pass。。。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP