location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)$
{
expires 1h;
}
more_set_headers -s 404 -t 'text/html' 'X-Foo: Bar';
location /foo {
more_set_input_headers 'Host: foo' 'User-Agent: faked';
# now $host, $http_host, $user_agent, and
# $http_user_agent all have their new values.
}
wget 'http://nginx.org/download/nginx-1.5.8.tar.gz' tar -xzvf nginx-1.5.8.tar.gz cd nginx-1.5.8/ # Here we assume you would install you nginx under /opt/nginx/. ./configure --prefix=/opt/nginx \ --add-module=/path/to/headers-more-nginx-module
make make install
more_set_headers "Server: my_server";
more_set_headers 'Foo: bar' 'Baz: bah';
more_set_headers -s 404 -s '500 503' 'Foo: bar';
more_set_headers -s '404 500 503' 'Foo: bar';
set $my_var "dog"; more_set_headers "Server: $my_var";
# This is NOT allowed!
server {
if ($args ~ 'download') {
more_set_headers 'Foo: Bar';
}
...
}
more_clear_headers
more_clear_headers -s 404 -t 'text/plain' Foo Baz;
more_set_headers -s 404 -t 'text/plain' "Foo: " "Baz: ";
more_clear_headers -s 404 -t 'text/plain' Foo Baz;
more_set_headers -s 404 -t 'text/plain' "Foo: " "Baz: ";
more_set_headers -s 404 -t 'text/plain' Foo Baz
more_clear_headers 'X-Hidden-*';
more_clear_input_headers -s 404 -t 'text/plain' Foo Baz;
more_set_input_headers -s 404 -t 'text/plain' "Foo: " "Baz: ";
more_clear_input_headers -s 404 -t 'text/plain' Foo Baz;
more_set_input_headers -s 404 -t 'text/plain' "Foo: " "Baz: ";
more_set_input_headers -s 404 -t 'text/plain' Foo Baz
# set the Server output header
more_set_headers 'Server: my-server';
# set and clear output headers
location /bar {
more_set_headers 'X-MyHeader: blah' 'X-MyHeader2: foo';
more_set_headers -t 'text/plain text/css' 'Content-Type: text/foo';
more_set_headers -s '400 404 500 503' -s 413 'Foo: Bar';
more_clear_headers 'Content-Type';
# your proxy_pass/memcached_pass/or any other config goes here...
}
# set output headers
location /type {
more_set_headers 'Content-Type: text/plain';
# ...
}
# set input headers
location /foo {
set $my_host 'my dog';
more_set_input_headers 'Host: $my_host';
more_set_input_headers -t 'text/plain' 'X-Foo: bah';
# now $host and $http_host have their new values...
# ...
}
# replace input header X-Foo *only* if it already exists
more_set_input_headers -r 'X-Foo: howdy';
more_set_headers "Server: jb51.net Web Server"; more_clear_headers "Content-Type:"; more_clear_headers "Accept-Ranges: "; more_clear_headers "Content-Length: ";
more_set_headers "Server: jb51.net Web Server"; more_set_headers -s 404 "Error: Not found"; more_clear_headers "Content-Type:"; more_clear_headers "Accept-Ranges: "; more_clear_headers "Content-Length: ";
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有