nginx中有关shtml的include另一个inc碎片时,页面报404.解决办法如下
location / {
ssi on;
ssi_silent_errors on;
ssi_types text/shtml;
root /opt/cms5/data/fileroot/dl;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
send_timeout 3600;
fastcgi_buffers 8 128k;
}
location ~ .*\.(inc)$ {
if (!-e $request_filename) {
return 200;
}
ssi on;
ssi_silent_errors on;
ssi_types text/shtml;
root /opt/cms5/data/fileroot/dl;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
send_timeout 3600;
fastcgi_buffers 8 128k;
}
及再找inc文件时,不存在则返回200状态码。
解决Nginx中shtml文件include问题导致的404错误
本文介绍了解决Nginx配置中shtml文件include另一个inc碎片时出现404错误的方法。通过设置正确的ssi参数和路径,确保了页面加载正确。此外,当找不到inc文件时,会返回200状态码,避免了404错误的显示。
820

被折叠的 条评论
为什么被折叠?



