lishenghan 发表于 2018-11-12 07:18:32

nginx-xbzy

server  
{
  
      listen    80;
  
      server_name localhost;
  
      #charset koi8-r;
  
      #access_log logs/host.access.log main;
  
      location / {
  
                #roothtml;
  
                #index index.html index.htm;
  
                proxy_pass http://backend_server;
  
                add_header X-Cache '$upstream_cache_status';
  
      }
  
      location ~* "\.(jpg|jpeg|png|bmp|swf|shtml|gif|html|css|js)$" {
  
                proxy_cache cache_one;
  
                proxy_cache_valid 200 2h;
  
                proxy_cache_valid 304 1m;
  
                proxy_cache_valid 301 302 1h;
  
                proxy_cache_valid any 1m;
  
                proxy_cache_key $host$uri$is_args$args;
  
                proxy_set_header Host$host;
  
                proxy_set_header X-Forwarded-For$remote_addr;
  
                proxy_pass http://backend_server;
  
    add_header X-Cache-Status $upstream_cache_status;
  
      }
  
    #error_page 404       /404.html;
  
    # redirect server error pages to the static page /50x.html
  
    #
  
    #error_page500 502 503 504 /50x.html;
  
    #location = /50x.html {
  
    #roothtml;
  
   # }
  

  

  

  

  
###########################################################################
  
#if (!-f $request_filename) {
  
#   rewrite ^/(.*)$ http://$host/lbt-www/ permanent;
  
#   break;
  
#}
  

  
    location ~ /purge(/.*)
  
    {
  
   allow            127.0.0.1;
  
   allow            10.10.20.0/24;
  
   allow            10.10.10.30;
  
#   deny            all;
  
   proxy_cache_purge    cache_one   $host$1$is_args$args;
  
    }
  
    location ~ .*\.(php|jsp|do|cgi)?$
  
    {
  
         proxy_set_header Host$host;
  
         proxy_set_header X-Forwarded-For$remote_addr;
  
         proxy_pass http://backend_server;
  
    }
  
   # access_logoff;
  
   location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
  
      {
  
                expires      30d;
  
      }
  
   location ~ .*\.(js|css)?$
  
      {
  
                expires      1h;
  
      }
  
access_loglogs/cache.log cache;
  
}


页: [1]
查看完整版本: nginx-xbzy