【ZT】使用Nginx的proxy_cache缓存功能取代Squid

 [文章作者:张宴 本文版本:v1.2 最后修改:2009.01.12 转载请注明原文链接:http://blog.s135.com/nginx_cache/]

  Nginx从0.7.48版本开始,支持了类似Squid的缓存功能。这个缓存是把URL及相关组合当作Key,用md5编码哈希后保存在硬盘上,所以它可以支持任意URL链接,同时也支持404/301/302这样的非200状态码。虽然目前官方的Nginx Web缓存服务只能为指定URL或状态码设置过期时间,不支持类似Squid的PURGE指令,手动清除指定缓存页面,但是,通过一个第三方的Nginx模块,可以清除指定URL的缓存。

  Nginx的Web缓存服务主要由proxy_cache相关指令集和fastcgi_cache相关指令集构成,前者用于反向代理时,对后端内容源服务器进行缓存,后者主要用于对FastCGI的动态程序进行缓存。两者的功能基本上一样。

  最新的Nginx 0.8.32版本,proxy_cache和fastcgi_cache已经比较完善,加上第三方的ngx_cache_purge模块(用于清除指定URL的缓存),已经可以完全取代Squid。我们已经在生产环境使用了 Nginx 的 proxy_cache 缓存功能超过两个月,十分稳定,速度不逊于 Squid。

  在功能上,Nginx已经具备Squid所拥有的Web缓存加速功能、清除指定URL缓存的功能。而在性能上,Nginx对多核CPU的利用,胜过Squid不少。另外,在反向代理、负载均衡、健康检查、后端服务器故障转移、Rewrite重写、易用性上,Nginx也比Squid强大得多。这使得一台Nginx可以同时作为“负载均衡服务器”与“Web缓存服务器”来使用。
  

--------------------------------------------------------------------------------

  1、Nginx 负载均衡与缓存服务器在 Linux 下的编译安装:

ulimit -SHn 65535
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.00.tar.gz
tar zxvf pcre-8.00.tar.gz
cd pcre-8.00/
./configure
make && make install
cd ../

wget http://labs.frickle.com/files/ngx_cache_purge-1.0.tar.gz
tar zxvf ngx_cache_purge-1.0.tar.gz

wget http://nginx.org/download/nginx-0.8.32.tar.gz
tar zxvf nginx-0.8.32.tar.gz
cd nginx-0.8.32/
./configure --user=www --group=www --add-module=../ngx_cache_purge-1.0 --prefix=/usr/local/webserver/nginx --with-http_stub_status_module --with-http_ssl_module
make && make install
cd ../


--------------------------------------------------------------------------------

  2、/usr/local/webserver/nginx/conf/nginx.conf 配置文件内容如下:

user www www;

worker_processes 8;

error_log /usr/local/webserver/nginx/logs/nginx_error.log crit;

pid /usr/local/webserver/nginx/nginx.pid;

#Specifies the value for maximum file descriptors that can be opened by this process.
worker_rlimit_nofile 65535;

events
{
use epoll;
worker_connections 65535;
}

http
{
include mime.types;
default_type application/octet-stream;

charset utf-8;

server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
client_max_body_size 300m;

sendfile on;
tcp_nopush on;

keepalive_timeout 60;

tcp_nodelay on;

client_body_buffer_size 512k;
proxy_connect_timeout 5;
proxy_read_timeout 60;
proxy_send_timeout 5;
proxy_buffer_size 16k;
proxy_buffers 4 64k;
proxy_busy_buffers_size 128k;
proxy_temp_file_write_size 128k;

gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.1;
gzip_comp_level 2;
gzip_types text/plain application/x-javascript text/css application/xml;
gzip_vary on;

#注:proxy_temp_path和proxy_cache_path指定的路径必须在同一分区
proxy_temp_path /data0/proxy_temp_dir;
#设置Web缓存区名称为cache_one,内存缓存空间大小为200MB,1天没有被访问的内容自动清除,硬盘缓存空间大小为30GB。
proxy_cache_path /data0/proxy_cache_dir levels=1:2 keys_zone=cache_one:200m inactive=1d max_size=30g;

upstream backend_server {
server 192.168.8.43:80 weight=1 max_fails=2 fail_timeout=30s;
server 192.168.8.44:80 weight=1 max_fails=2 fail_timeout=30s;
server 192.168.8.45:80 weight=1 max_fails=2 fail_timeout=30s;
}

server
{
listen 80;
server_name www.yourdomain.com 192.168.8.42;
index index.html index.htm;
root /data0/htdocs/www;

location /
{
#如果后端的服务器返回502、504、执行超时等错误,自动将请求转发到upstream负载均衡池中的另一台服务器,实现故障转移。
proxy_next_upstream http_502 http_504 error timeout invalid_header;
proxy_cache cache_one;
#对不同的HTTP状态码设置不同的缓存时间
proxy_cache_valid 200 304 12h;
#以域名、URI、参数组合成Web缓存的Key值,Nginx根据Key值哈希,存储缓存内容到二级缓存目录内
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;
expires 1d;
}

#用于清除缓存,假设一个URL为http://192.168.8.42/test.txt,通过访问http://192.168.8.42/purge/test.txt就可以清除该URL的缓存。
location ~ /purge(/.*)
{
#设置只允许指定的IP或IP段才可以清除URL缓存。
allow 127.0.0.1;
allow 192.168.0.0/16;
deny all;
proxy_cache_purge cache_one $host$1$is_args$args;
}

#扩展名以.php、.jsp、.cgi结尾的动态应用程序不缓存。
location ~ .*\.(php|jsp|cgi)?$
{
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_pass http://backend_server;
}

access_log off;
}
}


--------------------------------------------------------------------------------

  3、启动 Nginx:

/usr/local/webserver/nginx/sbin/nginx


--------------------------------------------------------------------------------

  4、清除指定的URL缓存示例:

  
http://code.google.com/p/sersync/
使用Nginx代替Squid服务器实现代理缓存 当有请求访问Nginx时,它将根据代理规则和缓存设置,检查缓存中是否存在相应的响应。代理缓存是一种将请求的响应保存在缓存中,以便在未来的请求中直接返回缓存的响应,从而减少对后端服务器的负载和提高响应速度的技术。通过以上的配置和设置,你可以使用Nginx作为代理缓存服务器,实现类似Squid的功能。请注意,具体的配置和参数可能根据你的实际需求而有所变化,请根据实际情况进行调整和修改。在本文中,我们将探讨如何使用Nginx来替代Squid服务器,实现代理缓存的功能。参数定义了缓存的名称和可用的内存大小, 阅读详情

相关推荐

PLC模拟量输入电路设计:±10V与±20mA信号调理全解析

在工业自动化和数据采集系统中,模拟量输入是连接物理世界与数字控制的核心桥梁。无论是变送器输出的4-20mA电流环,还是伺服驱动与信号发生器提供的±10V电压信号,PLC和采集模块都需要在复杂现场环境下稳定、精准地完成信号采集。理解信号体制的原理——电流环抗长线干扰、电压环响应快——是设计模拟输入前端的基础。通过精密电阻网络实现分压与采样,利用运放完成双极性到单极性的电平搬移,配合TVS与滤波电路保障可靠性,并经过ADC量化与校准流程,最终构建出兼顾精度、成本和工业级鲁棒性的完整信号链路。本文面向硬件工程师与

weixin_29163797的博客 298

Nginx缓存加速

【centos6.5】 一、Nginx缓存加速 1.0环境搭建: 1.0.1 nginx支持类似squid的缓存功能 把URL以及相关信息当成key,用MD5编码哈希后,把数据文件保存在硬盘上。只能为指定的URL或者状态码设置过期时间,并不支持类似squid的purge命令来手动清除指定缓存页面。 可通过第三方的ngx_cache_ourge来清除指定的URL缓存...

|汾西公子 2189

DeepSeek与豆包无缝对接:5分钟搞定智能周报自动化(附完整代码)

本文详细介绍了如何利用DeepSeek与豆包API,快速搭建一个智能周报自动化系统。通过整合豆包平台的工作流数据,并调用DeepSeek大模型进行深度分析与内容生成,该系统能在5分钟内自动抓取、分析多源信息,并生成结构清晰、富有洞察力的团队周报,显著提升工作效率。

weixin_29029995的博客 493

nginx图片服务器配置proxy_cache及purge错误解决方法

这里主要分享下centos环境nginx搭建图片服务器的过程以及遇到错误解决方法 一.nginx安装 这里需要用到ngx_cache_purge模块建议采用源码编译方式安装 1.安装pcre 下载pcre安装包 然后 ./configure make&makeinstall 2.下载需要用的模块及nginx安装包 nginx-1.4...

weixin_33860528的博客 486

EGO_Planner代码学习(三):px4ctrl代码流程

上节阅读了EGO_Planner的轨迹服务器部分的代码,其实质是将规划器生成的轨迹进行离散化,间隔10ms计算当前时刻在轨迹上的位置,并发送到话题上。这两天抽空看了下控制器部分的代码,在l这个软件包里,它的功能是进行px4的模式识别和上层控制,通过线性控制器把发布过来的位置命令解算成飞控的控制量,通过mavros发送给px4。下面就详细看一下它的启动过程。

qq_41069236的博客 6805

手把手教你用Excel自动化处理G14大额风险暴露报表(含211版模板)

本文针对G14大额风险暴露报表(含211版)手工填报效率低、易出错的核心痛点,提供了一套基于Excel VBA的完整自动化解决方案。文章详细讲解了如何构建从数据采集、清洗、关联客户识别、风险暴露计算到自动化校验与归档的完整工作流,并附有可操作的代码示例,旨在帮助银行风控人员大幅提升报表处理效率与准确性。

weixin_29304985的博客 447

Nginx Purge清除缓存配置

在编译安装Nginx的时候加上了Purge模块,来清除缓存. www.firefoxbug.net/index.html ==>> www.firefoxbug.net/purge/index.html就能清除. 但是之前配置过程中出现了404,但是缓存明明是存在的,就是Purge不了.后来更改Purge的配置就OK了 ## Cache_proxy Purge location ~

firefoxbug的专栏 1万+

安装破解IAR EWARM 8.2,提供注册机

IAR Embedded Workbench for ARM(IAR for ARM)是一款微处理器的集成开发环境软件,该集成开发环境中包含了IAR的C/C++编译器、 汇编工具、链接器、库管理器、文本编辑器、工程管理器和C-SPY调试器,支持ARM,AVR,MSP430等芯片。   一、安装 双击运行安装程序,点击Install IAR Embedded Workbench for ARM...

睿思派克 4万+

渗透测试——漏洞扫描工具

然后还要将all这个压缩包里的plugin_feed_info.inc提取出来,命令行是 tar -zxvf all-2.0.tar.gz plugin_feed_info.inc,然鹅,我提取不出来。将下载好的插件移动到Nessus目录下,然后输入sudo /opt/nessus/sbin/nessuscli update all-2.0.tar.gz。用户名和密码随便写写就好,随后将会更新补丁,OK,这样Nessus可以使用了。将会获得一串数字,然后去激活码的这个网站,输入自己的邮箱获取激活码。

wuli1024的博客 5005

【超详细】C#的单例模式

本文详细介绍了C#中的单例设计模式,包括两种实现方式:普通类泛型单例(Singleton<T>)和基于MonoBehaviour的组件单例(MonoSingleton<T>)。单例模式通过私有构造、静态私有实例和公共访问入口确保全局唯一实例,具有节省资源、保证数据一致性等优势。文章分别阐述了两者的核心原理、代码实现、使用场景及注意事项,并提供了日志管理器和音效管理器的具体应用示例。特别强调了多线程安全、初始化时机和避免过度使用等重要原则,为Unity开发中合理运用单例模式提供了全面指导。

grapefruit_lyy的博客 1533

100天精通Oracle-实战系列(第14天)Veritas NetBackup(NBU) 配合 RMAN 脚本备份 Oracle 数据库

100天精通Oracle-实战系列(第14天)Veritas NetBackup(NBU) 配合 RMAN 脚本备份 Oracle 数据库

LuciferLiu_DBA 1993

缓存配置

1、nginx永久缓存配置 为了得到更好的响应速度和用户体验,对于一些静态文件,nginx可以采用缓存策略,从而不用每次加载静态文件都向后台服务器发送请求。今天记录下nginx的缓存功能配置。 为了便于测试,先在后台服务器的index.html页面添加一张图片headimg.jpg,效果如下:...

chunjusu2447的博客 552

2026年Java 开发工程师常见面试简答题

本文整理了Java开发工程师面试常见简答题及详细解析,涵盖Java基础、集合框架、并发编程、JVM等核心考点。主要内容包括:1. Java基础概念:JDK/JRE/JVM区别、面向对象特性、重载与重写、接口与抽象类、String特性等 2. 集合框架:ArrayList/LinkedList区别、HashMap实现原理、线程安全方案、集合类型对比 3. 并发编程:synchronized原理、volatile作用、线程创建方式、线程池参数与策略、死锁处理 4. JVM相关:内存区域划分、垃圾回收算法、类加载

不务正业的猿 370

nginx探索(10)使用nginx的proxy_cache模块实现前端页面缓存(centos7环境下)

说明:可能我们都知道squid,squid是一个很流行的web页面缓存软件,接下来我们用nginx的proxy_cache模块实现类似squid的页面缓存功能。 1.搭建一台负载均衡服务器,同时这台服务器也做为proxy_cache缓存服务器ip为192.168.241.205搭建三台web服务器ip地址分别为192.168.241.10,192.168.241.11,192.168.241.12,当这四台服务器正常运转时,192.168.241.205接收到请求后会去192.168.241.10,192

u014415344的博客 820

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

SAP B1中文培訓教材_SDK

公司内部培训资料,对开发工具 ,DIAPI, UIAPI,Add-ON有详细解说

nginx的cache_purge模块及支持squidclient刷新的配置

nginx proxy_cache是一个类似squid的完整的缓存解决方案,它是0.7.44版本之后加入的功能,发展了比较长时间,想必也能稳定下来了。在没有proxy_cache之前只能用proxy_store缓存页面,因为nginx并没有为proxy_store设计任何刷新机制,所以要用的话还得加入外部设计的刷新功能,比如shell啊php等等,使用proxy_cache就会方便一些。<br /><br />一、proxy_cache<br /><br />proxy_cache在网上有很多的例子可以照搬

瞬间印象 1246

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

nginx添加proxy_cache模块做缓存服务器

业务需求nginx对后端tomcat(静态文件)做缓存 减轻后端服务器的压力 # nginx-1.6.2.tar.gz ngx_cache_purge-2.3.tar.gz #编译安装 ./configure --add-module=../ngx_cache_purge-2.3 --prefix=/usr/local/nginx --pid-path=/var/run/nginx/ngin...

huangbaokang的博客 2957

win10 跳过U8环境检测的IE WebControls.rar

win10 安装u8的时候 提示IE WebControls 不通过,这个工具可以欺骗u8的检查。 跳过U8环境检测的IE WebControls。提示导入失败后,重新检测通过。

Nginx+proxy_cache高速缓存配置

Nginx+proxy_cache高速缓存配置 2012-02-11 12:49:08|分类: 负载均衡Nginx |标签: |字号大中小订阅 前言* Nginx已经具备Squid所拥有的Web缓存加速功能、清除指定URL缓存的功能。而在性能上,Nginx对多核CPU的利用,胜过Squid不少。另外,在反向代理...

weixin_34163741的博客 225

nginx proxy_cache 缓存配置

前言: 由于本人工作原因,涉及到网络直播领域,其中视频的回放下载,涉及到了一些视频下载方面的技术。针对于一个完整视频的下载,目前市面上的主流做法是,先将整个视频流切片,存储到文件服务器中,在用户需要观看回放视频时。通过一个视频回源服务器,去文件服务器中逐个请求切片,返回给用户播放。 今天着重探讨的是关于回源服务器缓存的配置以及合理的缓存策略。 通过给回源服务器配置缓存的案例,详细讲解一整套缓

dengjiexian123的专栏 7万+

nginx proxy_cache 配置

使用Nginx的proxyCache缓存功能 Nginx从0.7.48版本开始,支持了类似Squid的缓存功能。这个缓存是把URL及相关组合当作Key,用md5编码哈希后保存在硬盘上,所以它可以支持任意URL链接,同时也支持404/301/302这样的非200状态码。虽然目前官方的Nginx Web缓存服务只能为指定URL或状态码设置过期时间,不支持类似Squid的PURGE指令,手动清

我是山寨南侠 828

Nginx purge_cache出现404的问题

最近给自建CDN添加了purge_cache模块,用于清除CDN缓存,添加后出现404,网上搜了一大堆都不符合我的情况,最终用Google搜索英文关键词解决。 解决办法 我原本的配置是这样的,看起来似乎并无问题,但是访问http://www.xiaoz.me/purge/1.jpg出现404 location ~ /purge(/.*) { allow all; proxy_cache_purge...

极客神殿 1539

nginx服务器默认的缓存文件,配置Nginx 缓存服务器

@import url(http://www.blogjava.net/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);@import url(http://www.blogjava.net/CuteSoft_Client...

weixin_39654848的博客 2837

nginx 缓存配置及报错解决

研究了2天的nginx缓存 出现各种报错 我把配置文件修改过后还是报错 1 2 3 4 5 6 7 location ~/purge(/.*) { allow 127.0.0.1; allow...

weixin_34244102的博客 3253

nginx反向代理做cache配置

本文抄自 [url] http://blog.sina.com.cn/s/blog_5dc960cd0100gvk2.html [/url] [code="java"] 需要第三方的ngx_cache_purge模块: wget http://labs.frickle.com/files/ngx_cache_purge-1.0.tar.gz tar zxvf ngx_cache_...

fengqinyun168的专栏 233

使用Nginx反向代理与proxy_cache缓存搭建CDN服务器的配置方法

为什么80%的码农都做不了架构师?>>> ...

weixin_33700350的博客 400

【代理服务器】Squid 反向代理与Nginx缓存代理

CDN的全称是(Content Delivery Network),即内容分发网络。其目的是通过在现有的Internet中增加一层新的CACHE(缓存)层,将网站的内容发布到最接近用户的网络”边缘“的节点,使用户可以就近取得所需的内容,提高用户访问网站的响应速度。从技术上全面解决由于网络带宽小、用户访问量大、网点分布不均等原因,提高用户访问网站的响应速度。

wang_dian1的博客 1681

web cache server方案比较:varnish、squid、nginx

  linux运维中,web cache server方案的部署是一个很重要的环节,选择也有很多种比如:varnish、squid、nginx。下面就对当下常用的这几个web cache server做一对比: 1)从功能上说:varnish和squid是专业的cache服务,而nginx的cache功能是由第三方模块完成。2)要做cache服务的话,肯定是要选择专业的cache服务,优先选择sq...

weixin_33894992的博客 410
上一篇: 适合初学者的LVS配置.
下一篇: 【ZT】图片延迟加载 jquery.lazyload插件
phpmaster
博客等级 码龄19年 0粉丝 24原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值