Linux论坛's Archiver

《开源》旗舰电子杂志2009年第1期火热下载!

nlw_000 发表于 2008-8-12 22:09

请教高手帮个忙怎样设置nginx的ssi 功能

在apache下有ssi模块支持,可以添加一些页面类似<!--#include virtual="/bb.shtml" -->这样的文件,请教高手在nginx怎么打开ssi 功能,怎么修改配置文件啊?小弟先谢过了

nlw_000 发表于 2008-8-14 10:34

I think error_page directive not work with SSI subrequest,
but, there's my alternate solution(more easy way):


set $index 'index.shtml';
set $store_file $request_filename;
if ($uri ~ /$ ){
    set $store_file $request_filename$index;
    rewrite (.*) $1index.shtml last;
}
location / {
    index index.shtml;
    proxy_store on;
    proxy_temp_path      /cache/temp;
    proxy_set_header   Host $host;
    proxy_set_header   X-Real-IP   $remote_addr;
    proxy_set_header   Via "s9/nginx";
    proxy_store_access   user:rw  group:rw  all:rw;
    if ( !-e $store_file ) {
        proxy_pass <[url=http://backend;][color=#0000ff]http://backend;>[/color][/url]
    }
}

有人提出此种方案,但是我有点不理解。还请哪位高手帮忙解释一下??

nlw_000 发表于 2008-8-15 10:58

nginx 在开启ssi功能后,<!--#include vitual="/bb.shtml" -->如果页面bb.shtml找不到,会显示一个错误。有没有好的办法或建议?还请各位高手指点一二

bitterness 发表于 2008-8-15 13:24

ssi本身可以用一些判断语句,不妨在这条命令前加上对这个文件的判断,不过,bb.shtml这个页面是在你本机上的吧,我倒没设过SSI,不妨查一下手册

nlw_000 发表于 2008-8-16 17:29

先谢谢了,不过怎么添加判断语句,我对这些也不是很懂。还请帮忙写一个让我参考一下!!

nlw_000 发表于 2008-8-27 11:11

有没有高手把源码修改下,增加个文件的判断?或者知道在哪里修改吗?

页: [1]

Powered by Discuz! Archiver 7.0.0  © 2001-2009 Comsenz Inc.