Nginx 教程


Nginx功能概述 为什么选择Nginx Nginx安装 常见问题(FAQ) 配置符号参考 调试 nginx 优化 Nginx 运行和控制Nginx


Nginx事件模块 Nginx主模块


Browser模块 Charset模块 Geo模块 HttpAccess模块 HttpAuthBasic模块 HttpAutoindex模块 HttpEmptyGif模块 HttpFcgi模块 HttpGzip模块 HttpHeaders模块 HttpIndex模块 HttpIndex模块. HttpLimit zone HttpLimitReqest模块 HttpLog模块 HttpProxy模块 HttpRewrite模块 HttpSSI模块 HttpUserId http核心模块 map Memcached


Addition模块 EmbeddedPerl flv GooglePerftools HttpDav模块 HttpGeoIP HttpGzipStatic HttpImageFilter HttpRealIp HttpSecureLink HttpSSL HttpSubstitution HttpXSLT RandomIndex StubStatus模块


MailAuth MailCore MailProxy MailSSL


nginx php-fpm安装配置 nginx在fedora上的安装 nginx在freebsd上的安装 nginx在ubuntu上的安装 nginx在windows上的安装


HWLoadbalancerCheckErrors nginx防盗链 负载均衡 完整例子 完整例子2 虚拟主机


This module adds the text encoding to the "Content-Type indicated" response-header.

Furthermore, module can reencode data of one encoding into another. It is necessary to note that the reencoding is accomplished only in one direction - from the server to the client, and only one-byte encodings can be reencoded.

Example configuration:

charset         windows-1251;
source_charset  koi8-r; 



syntax:*charset encoding|off*

default:*charset off*

context:*http, server, location, if in location*

The directive charset adds the line "Content-Type" into response-header with indicated encoding. If this encoding is differed from that indicated in directive source_charset, then reencoding is carried out. The parameter "off" deactivate the insertation of the line "Content-Type" in the response-header.


syntax:*charset_map encoding1 encoding2 {...}*


context:*http, server, location*

The directive charset_map describes the table of reencoding from one encoding into another. A table for the inverse reencoding is created using the same data. The codes of symbols are assigned in hexadecimal form. If no recorded symbols are in the range 80-FF they will be substituted with '?'.

Example usage:

charset_map  koi8-r  windows-1251 {
  C0  FE ; # small yu
  C1  E0 ; # small a

  C2  E1 ; # small b
  C3  F6 ; # small ts
  # ...

The complete table of conversion from koi8-r into Windows-1251 is distributed with nginx and is located in file conf/koi-win.


syntax:*override_charset on|off*

default:*override_charset off*

context:*http, server, location, if in location*

This directive determines, to carry out reencoding for the response, obtained from the proxied server or from FastCGI-server, if in the response-header a "Content-Type" header already is. If reencoding is permitted, then as the initial encoding the encoding, indicated in the obtained answer, is used.

It is necessary to note that if the response was obtained in the subquery then, independent of directive override_charset, is always carried out reencoding from encoding of the response into encoding of basic demand.


syntax:*source_charset encoding*


context:*http, server, location, if in location*

The directive source_charset assigns the initial encoding of response. If this encoding is differed from that indicated in directive charset, then reencoding is carried out.


Original Documentation