Nginx http模块(九)

来源:百度文库 编辑:神马文学网 时间:2024/04/25 14:28:43

Server_name

语法:server_name name [……]

默认值:server_name hostname

Contextserver

为虚拟服务器指定名字

Server {

              Server_name example.com *.example.com;

}

上面这两个名字可以写在一起

Server {

   Server_name .example.com;

}

如果,客户请求中没有“Host”头部,或是那个请求不匹配任何一个server_namehttp重定向中使用server最基本的名字。也可以仅仅使用“*”强迫nginxhttp重定向中使用“Host”头部(但注意“*”不能作为第一个名字出现,但可以使用假名“_”来代替)。

Server {

   Server_name example.com *;

}

Server {

   Server_name - *

}

Server_names_hash_max_size

语法:server_names_hash_max_size number

默认值:server_names_hash_max_size 512

Contexthttp

指定服务器名哈希表的最大值,

Directive assigns the maximum size of the hash-tables of the names of servershash.In greater detail see in the description of tuning

Server_names_hash_bucket_size

语法:server_names_hash_buket_size

默认值:server_names_hash_buket_size 32/64/128

Contexthttp

指定服务器名哈希表的basket 的大小,这个值依赖于处理器cache line的大小。

Directive assigns the size of basket in the hash-tables of the names of servers. This value by default depends on the size of the line of processor cache. In greater detail see in the description of tuning hash.

Tcp_nodelay

语法:tcp_nodelay [ on | off ]

默认值:tcp_nodelay on

Contexthttpserverlocation

这个指令允许或禁止socketTCP_NODELAY选项。仅仅包含在keep-alive连接中

Tcp_nopush

语法:tcp_nopush [ on | off ]

默认值:tcp_nopush off

Contexthttpserverlocation

   此指令允许或禁止使用socketTCP_NOPUSH(on FreeBSD)TCP_CORK(on Linux)选项.此选项仅仅在使用sendfile的时候可用。

Setting this option causes nginx to attempt to send it's HTTP response headers in one packet on Linux and FreeBSD 4.x