HttpSsiModule
This module provides a filter which processes Server-Side Includes (SSI) in the input. The list of the supported commands for SSI is currently incomplete.
以下是测试环境的配置示例
1、反向代理Server,开启SSI模块,在反向代理location下增加:
location / {
#开启SSI模块
ssi on;
proxy_intercept_errors on;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:7001;
error_page 404 =200 /404.html;
error_page 502 /502.html;
}
2、确保存在/ssi的location配置
location /ssi/ {
alias /app/html/static/;
}
3、页面使用ssi引用
<!--# include file="/ssi/ssi_test.html" -->
需注意文件的位置:示例ssi_test.html的实际主机的文件位置是 /app/html/static/ssi_test.html
The target of "file" or "virtual" must be a location in the server configuration.
http://wiki.nginx.org/HttpSsiModule
可参考其他使用,例如参数传递
SSI开启后,nginx将不会发送HTTP头信息中的 Last-Modified和Content-Length,所以此类页面可能不会被浏览器缓存