[Ask for help] Questions about proxy_cache and ssi

foxbin nginx-forum at nginx.us
Wed Sep 25 12:28:27 UTC 2013


hi,mex :

this is my nginx config:

user  nobody;
worker_rlimit_nofile 65500;
worker_processes  8;
error_log  logs/error.log;

events {
    use epoll;
    worker_connections  65500;
}

http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;
    gzip  off;
    client_max_body_size 1g;
    proxy_redirect off;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

    ssi on;
    ssi_silent_errors on;
    ssi_types text/shtml;
    index index.shtml index.html index.htm;

    access_log  logs/access.log ;

    proxy_temp_path /cache/proxy_temp;
    proxy_cache_path /cache/proxy_cache levels=1:2 keys_zone=tmp_cache:2000m
inactive=10000d max_size=200G;
    proxy_next_upstream error timeout invalid_header http_504 http_500 
http_502 http_503;

    upstream backend {
        server 192.168.1.100;
        server 192.168.1.101;
        server 192.168.1.102 backup;
   }

    server {
            server_name www.x.com ;

            location / {
                proxy_set_header Host $host;
                proxy_set_header X-Forwarded-For $remote_addr;
                proxy_pass http://backend;
                proxy_cache tmp_cache;
                proxy_cache_key $host$uri;
                proxy_cache_valid 1000d;
            }

            location ~ /purge(/.*) {
                allow 192.168.1.254;
                deny all;
                proxy_cache_purge tmp_cache $host$1$is_args$args;
            }

}




shtml files:
www.x.com/1.shtml      <!--#include virtual="/include/foot.html"-->
www.x.com/2.shtml      <!--#include virtual="/include/foot.html"-->
www.x.com/3.shtml       <!--#include virtual="/include/foot.html"-->
www.x.com/4.shtml       <!--#include virtual="/include/foot.html"-->
www.x.com/5.shtml       <!--#include virtual="/include/foot.html"-->
www.x.com/6.shtml       <!--#include virtual="/include/foot.html"-->
......more


include files:
http://www.x.com/purge/include/foot.html   <html> old, i am include info !
</html>


Edit this file: http://www.x.com/include/include/foot.html   <html> new, i
am include info !  <\html>



I use ngx_cache_purge to clear the cache :
http://www.x.com/purge/include/foot.html



But do not take effect cache these pages :
open http://www.x.com/1.shtml
the content is :
<html>
old, i am include info !
<\html>

open http://www.x.com/2.shtml
the content is :
<html>
old, i am include info !
<\html>



I have to clear the cache in order to take effect :
http://www.x.com/purge/1.shtml
http://www.x.com/purge/2.shtml


open http://www.x.com/1.shtml
the content is :
<html>
hello world1 !
new, i am include info !
<\html>

open http://www.x.com/2.shtml
the content is :
<html>
hello world2 !
new, i am include info !
<\html>




If I have a lot shtml files ,Must be more clear the cache  :(
http://www.x.com/purge/1.shtml
http://www.x.com/purge/2.shtml
http://www.x.com/purge/3.shtml
http://www.x.com/purge/4.shtml
http://www.x.com/purge/5.shtml
http://www.x.com/purge/6.shtml
.......more


I just need to clear a cache: http://x.com/purge/include/foot.html , all
SHTML pages to take effect.

Is there a way to solve?

Thanks in advance :)

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,243085,243088#msg-243088



More information about the nginx mailing list