Chinaunix

标题: nginx return 的问题 [打印本页]

作者: helloiac    时间: 2013-12-09 18:17
标题: nginx return 的问题
使用
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.

哪里不对
作者: helloiac    时间: 2013-12-10 10:19
大神来来来来
作者: helloiac    时间: 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上
求解决
作者: ai之凯    时间: 2013-12-10 19:40
还没怎么用过return,我一般都是proxy_pass。。。




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2