【 Nginx 】proxy_cache 模块的使用记录
部署环境:nginx + tomcat 同一台服务器。
通过nginx反向代理tomcat。
配置如下:
user www www;
worker_processes auto; error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info; pid logs/nginx.pid; worker_rlimit_nofile ; events {
use epoll;
multi_accept on;
worker_connections ;
} http {
server_tokens off;
include mime.types;
default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"'; access_log logs/access.log main;
open_log_file_cache max= inactive=15s min_uses= valid=5m; sendfile on;
tcp_nopush on; #keepalive_timeout ;
keepalive_timeout ;
client_header_timeout 2m;
client_body_timeout 3m;
reset_timedout_connection on;
send_timeout 15s; open_file_cache max= inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses ;
open_file_cache_errors on; gzip on;
gzip_disable "msie6";
gzip_proxied any;
gzip_comp_level ;
gzip_min_length 1k;
gzip_vary on;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript; proxy_connect_timeout ;
proxy_send_timeout ;
proxy_read_timeout ;
proxy_buffer_size 16k;
proxy_buffers 64k;
proxy_busy_buffers_size 128k;
proxy_temp_file_write_size 128k;
proxy_cache_path /usr/local/nginx/cache/proxy_cache_dir levels=: keys_zone=cache_one:200m inactive=1d max_size=30g; upstream backend_tomcat {
server 10.0.10.5: weight= max_fails= fail_timeout=;
} server {
listen ;
server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / {
#root html;
#index index.html index.htm;
#proxy_pass http://10.0.10.5:10888;
proxy_cache cache_one;
proxy_cache_valid 12h;
proxy_cache_bypass $cookie_nocache $arg_nocache$arg_comment;
proxy_cache_key $host$uri$is_args$args;
proxy_pass http://backend_tomcat;
#expires 1d;
} #location ~ .*\.() #error_page /.html; # redirect server error pages to the static page /50x.html
#
error_page /50x.html;
location = /50x.html {
root html;
} # proxy the PHP scripts to Apache listening on 127.0.0.1:
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#} # deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
} # another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen ;
# listen somename:;
# server_name somename alias another.alias; # location / {
# root html;
# index index.html index.htm;
# }
#} # HTTPS server
#
#server {
# listen ssl;
# server_name localhost; # ssl_certificate cert.pem;
# ssl_certificate_key cert.key; # ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m; # ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on; # location / {
# root html;
# index index.html index.htm;
# }
#}
include vhosts/*.conf;
}
在此次配置中,使用到了proxy_cache模块,也因为这个模块造成了一个问题:
用户通过页面登录系统,然后在通过页面按钮,点击退出。这时,如果点击浏览器的退后按钮aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGwAAAAsCAIAAAAPXMr2AAAQ30lEQVRoge1a63NUZZo/f8Z83Y/7cYsqS/ywSElSjI4EVMKCJGA6E1iFIBetMW7VVjEINWPVMDYjjgI6kk12HbAcFSHClkiFdM5JghhycUHZjXaf++U977n26XPo3g/v9XR3gJ0RP+3Tp9/3eZ/n9/yey+kk5AShXq/X6/U7d+5kWZamabVaDcPQdV1RFL/77jtiz9IMSZohNc2yLGs0GoGrXzvzL9L7z98af+v6B7+cfecfZ04+cfOjwnd/2bo0tvNm6fDc5X/9fvJ3sac3Go00TbMsS7M0S9Ns/OCG4XKWZVlwaejn+07fCLIUk6eZNV3cvPmdb7Ns/KBwcDxrkTRNs3T84IbhSkpqmy6ubpHiNObLMuvTvp8Jwt+t7NtXPP3p+FwlwA2lU8WDnwZZlmXWJ0OrV69e3bevOHxpz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O4wAX2I7DU1O4ppFmScW5RcMpNV3XDQO6cGFx8fTp04cOHXr11VePHDkyMjJy89YtF0LDMNq2xqh1Xdc06LqSKCVJ0jrEw4eP/PrXh/hL0DRN0xCXRhvWqOjacqK3B+lNWhvO+5LlE7f1o7ljq65p+EsHkqdp6PvDfWbQNc11XUmSWv82EATB0tLS7du3lzgRVFXVVFXVNE1T+YZVTUNGDEA7OpIAtmsa1jRNUzWMUDVN5YeoUi4EV2kGnI4ufApagYZXSoAupBJGTEpKpq3hF632Xq1B1xXbDTFN0yAImp4/CaqqqqqiKqqqsiE+iEtRuL+PKbkTKmFZUWiNSg6otAS1IcEgRVUVRVUVlUucL0Khi6qqKvokov/Iek8RUGGKqiiK8kCHqCqKoiiKqiioFXxEZ9QhdaEXCVAxkqBUlY9mJJiUBvOtqQq9DYiLwHJMDAWAOzMzXa1W6/X6vYeoKLKsyIoiK/KDHaKiyKheWVEUGevYKOOzrFAUdaGF6LJMDoqSYyS0mALz0dZYlJyLox6Zs8qKYtv2zZs3VVVNkqT1P943iYDLkhVZRq3IqCeZCmoSabyd+mWFRNID8+WhCsXz8cxEg3FOjojR59kVXmku669uTVEUx3Fu3bw1PT09NTUlTUnSlDTFPSthiiQJckWWKxW5UpErsixX0EmWZbnCGCuVSkWW6YWdFVmuYBfxMZZKhcYjP4FhegKVK4SLJcJRlJkXRiszggrRZVIGTvI3taYoim3b9/ibDoQQQqHCibzMfheFGpgu01Vu9dI4OYeXm3Hk5nBWuQ1L5S4itzs8kNaEcqVcqVTKlXK5XEF6pVyuVMplZK5UyIbPVMeuchnhSQSNxTbsxMEYyTGWacoKnxBHlXPJSCRJSSsqs9JIE1z4A29NKOMz3ivkVOasvDGv5tA5GJkWs+JR5ZlwMXQs+RwVHtgUSc5NBVd45E/UmvDnP5/5/+tvvP4XD+45QE+9tTcAAAAASUVORK5CYII=" alt="" />
就会出现页面为登出系统的界面,刷新也是停留在登录后的页面,还可以进行一系列的操作。
通过这个问题,我还是对proxy_cache模块的怀疑,是否proxy_cache对session也存在缓存的问题。
再次修改配置文件,取消proxy_cache的使用,上述问题得到解决。如果proxy_cache模块对每个需要登录的网站都存在以上问题,那proxy_cache存在的必要是什么?
【 Nginx 】proxy_cache 模块的使用记录的更多相关文章
- Nginx 切片模块、断点续传
熟悉 CDN 行业主流技术的朋友应该都比较清楚,虽然 Nginx 近几年发展的如日中天,但是基本上没有直接使用它自带的 proxy_cache 模块来做缓存的,原因有很多,例如下面几个: 不支持多盘 ...
- nginx缓存配置的操作记录梳理
web缓存位于内容源Web服务器和客户端之间,当用户访问一个URL时,Web缓存服务器会去后端Web源服务器取回要输出的内容,然后,当下一个请求到来时,如果访问的是相同的URL,Web缓存服务器直接输 ...
- (转)nginx 常用模块整理
原文:http://blog.51cto.com/arm2012/1977090 1. 性能相关配置 worker_processes number | auto: worker进程的数量:通常应该为 ...
- nginx常用模块(三)
Nginx常用模块(三) ngx_http_proxy_module模块配置(http或https协议代理) proxy_pass URL; 应用上下文:location, if in locatio ...
- nginx -- handler模块(100%)
handler模块简介 相信大家在看了前一章的模块概述以后,都对nginx的模块有了一个基本的认识.基本上作为第三方开发者最可能开发的就是三种类型的模块,即handler,filter和load-ba ...
- Nginx限速模块初探
Nginx限速模块分为哪几种?按请求速率限速的burst和nodelay参数是什么意思?漏桶算法和令牌桶算法究竟有什么不同?本文将带你一探究竟.我们会通过一些简单的示例展示Nginx限速模块是如何工作 ...
- nginx常用模块
Nginx模块介绍 核心模块:core module 标准模块:stand modules HTTP modules: Standard HTTP modules Optional HTTP modu ...
- [转帖]Nginx rewrite模块深入浅出详解
Nginx rewrite模块深入浅出详解 https://www.cnblogs.com/beyang/p/7832460.html rewrite模块(ngx_http_rewrite_modul ...
- Nginx RTMP 模块 nginx-rtmp-module 指令详解
译序:截至 Jul 8th,2013 官方公布的最新 Nginx RTMP 模块 nginx-rtmp-module 指令详解.指令Corertmp语法:rtmp { ... }上下文:根描述:保存所 ...
随机推荐
- Toward Convolutional Blind Denoising of Real Photographs
本文提出了一个针对真实图像的盲卷积去噪网络,增强了深度去噪模型的鲁棒性和实用性. 摘要 作者提出了一个 CBD-Net,由噪声估计子网络和去噪子网络两部分组成. 作者设计了一个更加真实的噪声模型,同时 ...
- 常量表达式 & constexpr
[常量表达式] 一个这样的表达式:值不会改变 && 在编译过程中就能够得到计算结果 常见的常量表达式:字面值.用常量表达式初始化的const对象 一个对象是不是常量表达式由它的数据类型 ...
- 软件工程项目组Z.XML会议记录 2013/11/06
软件工程项目组Z.XML会议记录 [例会时间]2013年11月06日星期二21:00-22:00 [例会形式]小组讨论 [例会地点]三号公寓楼会客厅 [例会主持]李孟 [会议记录]薛亚杰 会议整体流程 ...
- lintcode-135-数字组合
135-数字组合 给出一组候选数字(C)和目标数字(T),找到C中所有的组合,使找出的数字和为T.C中的数字可以无限制重复被选取. 例如,给出候选数组[2,3,6,7]和目标数字7,所求的解为: [7 ...
- lintcode-104-合并k个排序链表
104-合并k个排序链表 合并k个排序链表,并且返回合并后的排序链表.尝试分析和描述其复杂度. 样例 给出3个排序链表[2->4->null,null,-1->null],返回 -1 ...
- iOS-SDWebImage的原理以及使用流程
SDWebImage 支持异步的图片下载+缓存,提供了 UIImageView+WebCacha 的 category,方便使用.SDWebImage加载图片的流程: 1. 入口 setImageWi ...
- Intellij IDEA将工程打包成jar包并执行
打开File -> Project Structure -> Artifacts 点击“+”,选择“Jar”,选择Empty或From modules with dependencies, ...
- [Leetcode] Length of last word 最后一个单词的长度
Given a string s consists of upper/lower-case alphabets and empty space characters' ', return the le ...
- [bzoj 2115]线性基+图论
题目链接:http://www.lydsy.com/JudgeOnline/problem.php?id=2115 给定一个带权无向图,要找出从1到n路径权值异或和最大的那一条的路径异或和. 考虑1到 ...
- idea 导入spring 源码注意的问题
问题:idea导入spring 源码的步骤是: 首先从官网下载spring的源码:git clone https://github.com/spring-projects/spring-framewo ...