### Browser模塊
### 摘要
This module creates variables, the values of which depend on the request header "User-agent":
本模塊的變量基于請求頭(header)中的"User-agent":
- $modern_browser - is equal to the value, assigned by directive modern_browser_value, if browser is identified as an **modern** browser;
- $ancient_browser - 當等于指定給modern_browser_value的瀏覽器時,這個瀏覽器被認定為新版的瀏覽器;
- $ancient_browser - is equal to the value, assigned by directive ancient_browser_value, if browser is identified as an **old** browser;
- $ancient_browser - 當等于指定給ancient_browser_value的瀏覽器時,這個瀏覽器被認定為老版的瀏覽器;
- $msie - is equal **1**, if browser is identified as MSIE with any version;
- $msie - 當瀏覽器為MSIE的任何版本時,這個值等于1;
If you don't need this module add --without-http_browser_module parameter to the ./configure call, at compile time.
如果不需要這個模塊時,在編譯的時候加上 --without-http_browser_module.
Example configuration 例如配置
Selection of the index file:
選擇索引文件:
~~~
modern_browser_value "modern.";
modern_browser msie 5.5;
modern_browser gecko 1.0.0;
modern_browser opera 9.0;
modern_browser safari 413;
modern_browser konqueror 3.0;
index index.${modern_browser}html index.html;
~~~
Redirect for the old browsers:
定義老的瀏覽器:
~~~
modern_browser msie 5.0;
modern_browser gecko 0.9.1;
modern_browser opera 8.0;
modern_browser safari 413;
modern_browser konqueror 3.0;
modern_browser unlisted;
ancient_browser Links Lynx Netscape4;
?
if ($ancient_browser){
rewrite ^ /ancient.html;
}
~~~
### 指令
### ancient_browser
**syntax:***ancient_browser line [ line... ]*
**default:***no*
**context:***http, server, location*
Directive assigns the substrings, during presence of which in the line "User-agent", browser are considered as **old**.
Special line "netscape4" corresponds to regular expression "^Mozilla/[1-4] ".
### ancient_browser_value
**syntax:***ancient_browser_value line*
**default:***ancient_browser_value 1*
**context:***http, server, location*
Directive assigns value for the variables $ancient_browser.
定義 $ancient_browser的變量值.
### modern_browser
**syntax:***modern_browser browser version|unlisted*
**default:***no*
**context:***http, server, location*
Directive assigns which version of the browser is to be considered as **modern**.
As browser you can assign the values msie, gecko (Mozilla-based browsers) opera, safari, konqueror.
Of versions it is possible to assign in size X, X.X, X.X.X, or X.X.X.X. maximum values for each of their sizes respectively - 4000, 4000.99, 4000.99.99, and 4000.99.99.99.
Special value "unlisted" indicates to consider modern browser, not described by the modern_browser and ancient_browser directives.
Otherwise the neperechislennyy browser will be considered become obsolete.
If the headers do not contain "User-agent", the browser is considered neperechislennym.
### modern_browser_value
**syntax:***modern_browser_value line*
**default:***modern_browser_value 1*
**context:***http, server, location*
Directive assigns value for the variables $modern_browser.
定義$modern_browser的變量值.
### References
[Original Documentation](http://sysoev.ru/nginx/docs/http/ngx_http_browser_module.html "http://sysoev.ru/nginx/docs/http/ngx_http_browser_module.html") new since 26.09.2006 version 0.4.3
- 主要文檔
- Nginx功能概述
- 為什么選擇Nginx
- Nginx安裝
- 運行和控制Nginx
- 配置符號參考
- 優化 Nginx
- 常見問題(FAQ)
- 調試 nginx
- 核心模塊
- Nginx主模塊
- Nginx事件模塊
- 基本模塊
- http核心模塊
- HttpIndex模塊
- HttpAccess模塊
- HttpAuthBasic模塊
- HttpAutoindex模塊
- Browser模塊
- Charset模塊
- HttpEmptyGif模塊
- HttpFcgi模塊
- Geo模塊
- HttpGzip模塊
- HttpHeaders模塊
- HttpIndex模塊
- HttpReferer模塊
- HttpLimit zone
- HttpLimitReqest模塊
- HttpLog模塊
- map
- Memcached
- HttpProxy模塊
- HttpRewrite模塊
- HttpSSI模塊
- HttpUserId
- 其他模塊
- Addition模塊
- EmbeddedPerl
- flv
- HttpGzipStatic
- RandomIndex
- HttpGeoIP
- HttpRealIp
- HttpSSL
- StubStatus模塊
- HttpSubstitution
- HttpDav模塊
- GooglePerftools
- HttpXSLT
- HttpSecureLink
- HttpImageFilter
- mail模塊
- MailCore
- MailAuth
- MailProxy
- MailSSL
- 安裝
- nginx在windows上的安裝
- nginx在freebsd上的安裝
- nginx在ubuntu上的安裝
- nginx在fedora上的安裝
- nginx php-fpm安裝配置
- 配置示例和方法
- 完整例子
- 完整例子2
- 虛擬主機
- 負載均衡
- nginx防盜鏈
- HWLoadbalancerCheckErrors