nginx配置中rewrite中变量判断conditon
来源:互联网 发布:网络电视频道调不出来 编辑:程序博客网 时间:2024/06/04 00:22
译文:http://nginx.org/en/docs/http/ngx_http_rewrite_module.html
google关键字: nginx variable condition
if (condition
) { ... }
server
, location
The specified condition
is evaluated. If true, this module directives specified inside the braces are executed, and the request is assigned the configuration inside the if
directive. Configurations inside the if
directives are inherited from the previous configuration level.
A condition may be any of the following:
- a variable name; false if the value of a variable is an empty string or “
0
”;Before version 1.0.1, any string starting with “
0
” was considered a false value. - comparison of a variable with a string using the “
=
” and “!=
” operators; - matching of a variable against a regular expression using the “
~
” (for case-sensitive matching) and “~*
” (for case-insensitive matching) operators. Regular expressions can contain captures that are made available for later reuse in the$1
..$9
variables. Negative operators “!~
” and “!~*
” are also available. If a regular expression includes the “}
” or “;
” characters, the whole expressions should be enclosed in single or double quotes. - checking of a file existence with the “
-f
” and “!-f
” operators; - checking of a directory existence with the “
-d
” and “!-d
” operators; - checking of a file, directory, or symbolic link existence with the “
-e
” and “!-e
” operators; - checking for an executable file with the “
-x
” and “!-x
” operators.
Examples:
if ($http_user_agent ~ MSIE) { rewrite ^(.*)$ /msie/$1 break;}if ($http_cookie ~* "id=([^;]+)(?:;|$)") { set $id $1;}if ($request_method = POST) { return 405;}if ($slow) { limit_rate 10k;}if ($invalid_referer) { return 403;}
A value of the $invalid_referer
embedded variable is set by the valid_referers directive.
0 0
- nginx配置中rewrite中变量判断conditon
- nginx中rewrite配置规则
- nginx中rewrite配置问号处理
- thinkphp 在 nginx 中配置 (rewrite)
- nginx中rewrite和proxy_pass
- linux中nginx访问url rewrite
- NGINX的REWRITE配置
- nginx 配置 rewrite 跳转
- nginx rewrite配置
- nginx rewrite 配置
- nginx 配置说明 rewrite
- nginx rewrite 配置实例
- Nginx的Rewrite配置
- nginx配置ThinkPHP Rewrite
- Nginx的Rewrite配置
- Nginx rewrite配置规则
- Nginx配置基础-rewrite
- Nginx之rewrite配置
- unix中的信号列表
- Linux Centos 6.6安装Mysql
- MFC技术内幕系列之(五)---MFC文档序列化内幕
- Javascript arguments对象
- 支付宝国际支付 对接
- nginx配置中rewrite中变量判断conditon
- RROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
- alertView中的属性和方法的讲解
- 【Java】检查二叉树是否平衡。
- Android主activity向自定义view传递参数
- SAP主数据管理
- EGOCache如何检测缓存时间过期
- poj 3667 Hotel (线段树 + 合并操作)
- 悟空学Linux专栏----第33篇