apache默认不支持ssi的,可以在apache下做如下设置:
修改Apache配置文件httpd.conf
1. 确认加载include.so模块,将注释去掉:
LoadModule include_module libexec/apache2/mod_include.so
2. AddType部分去掉这两段注释:
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
3. Directory目录权限里面找到
Options Indexes FollowSymLinks
增加Includes修改为:
Options Indexes FollowSymLinks Includes
4. 重新启动Apache
在nginx下做如下设置:
在 http 段添加:
ssi on;
ssi_silent_errors off;
ssi_types text/shtml;
或
location ~* \.shtml$ {
ssi on;
ssi_silent_errors off;
ssi_value_length 1024;
ssi_types text/shtml;
}
或
location / {
ssi on;
ssi_silent_errors on;
ssi_value_length 1024;
ssi_types text/shtml;
}