本模板可以设置HTTP报文的头标。
__示例__:
: expires 24h;
: expires 0;
: expires -1;
: expires epoch;
: add_header Cache-Control private;
指令
[#add_header add_header]
[#expires expires]
增加头标
语法: add_header name value
默认值: none
作用域: http, server, location
当HTTP应答状态码为 200、204、301、302 或 304 的时候,增加指定的HTTP头标。
其中头标的值可以使用变量。
expires
语法: expires [time|epoch|max|off]
默认值: expires off
作用域: http, server, location
使用本指令可以控制HTTP应答中的“Expires”和“Cache-Control”的头标,(起到控制页面缓存的作用)。
可以在time值中使用正数或负数。“Expires”头标的值将通过当前系统时间加上您设定的 time 值来获得。
epoch 指定“Expires”的值为 1 January, 1970, 00:00:01 GMT。
max 指定“Expires”的值为 31 December 2037 23:59:59 GMT,“Cache-Control”的值为10年。
-1 指定“Expires”的值为 服务器当前时间 -1s,即永远过期
“Cache-Control”头标的值由您指定的时间来决定:
负数:Cache-Control: no-cache
正数或零:Cache-Control: max-age = #, # 为您指定时间的秒数。
"off" 表示不修改“Expires”和“Cache-Control”的值
原始文档:http://sysoev.ru/nginx/docs/http/ngx_http_headers_module.html
分享到:
相关推荐
ngx_security_headers 此NGINX模块以正确的方式(c)添加了安全标头,并删除了不安全的标头。概要http { security_headers on; ...} 运行curl -IL https://example.com/将产生添加的安全标头: ...
nginx扩展工具,nginx的headers_more模块用于 添加、修改或清除 请求/响应头,该模块不是nginx自带的,默认不包含该模块,需要另外安装。幸运的是openresty默认包含了该模块,可以直接使用。 该模块主要有4个指令...
and these addon module: 和这些插件模块: array-var-nginx-module ngx_devel_kit ngx-coolkit-module echo-nginx-module form-input-nginx-module encrypted-session-nginx-module set-misc-nginx-module ngx-...
headers-more-nginx-module-0.34
ngx_http_headers_module模块 一. 前言 ngx_http_headers_module模块提供了两个重要的指令add_header和expires,来添加 “Expires” 和 “Cache-Control” 头字段,对响应头添加任何域字段。add_header可以用来标示...
ngx_http_uwsgi_module and ngx_http_scgi_module. *) Bugfix: in virtual servers handling with SNI. *) Bugfix: new sessions were not always stored if the "ssl_session_cache shared" directive was used...
headers-more-nginx-module-0.30.tar.gz
本文档介绍了2017年11月3日发布的headers-more-nginx-module 。 概要 # set the Server output header more_set_headers 'Server: my-server' ; # set and clear output headers location /bar { more_set_...
nginx1.12.2源码、pcre-8.4.3源码、zlib-1.2.11源码包、openssl-1.0.2r源码包、echo-nginx-module-master模块源码、headers-more-nginx-module-master源码包、ngx_http_substitutions_filter_module源码包;...
*) Bugfix: in the ngx_http_v2_module. Thanks to Piotr Sikora. *) Bugfix: nginx did not support dates after the year 2038 on 32-bit platforms with 64-bit time_t. *) Bugfix: in handling of dates ...
前置条件:需要编译 ngx_http_headers_module 模块,才支持 header 头信息操作 add_header 意思为将自定义的头信息的添加到响应头,指令为 add_header name value [always];,可以用在 http {}, server {}, ...
包含模块nginx, nginx doc, Lua, Naxsi, Rtmp, HttpSubsModule,echo-nginx, lower_upper_case, headers-more,auth_ldap, set-misc, lua-upstream, encrypted-session,limit-traffic, AJP, form-input, upstream_...
具体配置可参考官方文档 http://nginx.org/en/docs/http/ngx_http_headers_module.html#expires [root@cairui conf]# cat nginx.conf | egrep -v #|^$ user nginx; worker_processes 1; events { worker_...
安装NGINX,并将以下模块添加到您的安装中: 用yourdomain.com替换出现的wordpress.samples.playform.cloud的每次出现 生成DH参数: mkdir -p /etc/nginx/ssl/ cd /etc/nginx/ssl/ sudo openssl dhparam