1. 软件包版本:

Nginx 1.4.7

Ngx_cache_purge-2.0

Openssl-1.0.1

Pcre-8.32

二、安装编译:

a)         下载pcre-8.32.tar.gz      
tar zvxf pcre-8.32.tar.gz
cd pcre-8.32 && ./configure && make && make install

b)         下载openssl-1.0.1.tar.gz
cd openssl && ./configure && make && make install

c)         下载ngx_cache_purge-2.0.zip
unzip ngx_cache_purge-2.0.zip

d)         下载nginx-1.4.7.tar.gz
cd nginx-1.4.7
./configure --prefix=/opt/nginx --add-module=../ngx_cache_purge-2.0 --with-http_stub_status_module --with-http_realip_module --with-http_ssl_module --with-pcre=../pcre-8.32 --with-openssl=/opt/soft/openssl-1.0.1

Make && make install

三、nginx配置:

a)         Vi /opt/nginx/conf/nginx.conf

user  www www;

worker_processes 8;

error_log  /opt/nginx/logs/nginx_error.log  crit;

pid        /opt/nginx/logs/nginx.pid;

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

worker_rlimit_nofile 51200;

events

{

use epoll;

worker_connections 65535;

}

http

{

include       mime.types;

default_type  application/octet-stream;

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;

fastcgi_connect_timeout 300;

fastcgi_send_timeout 300;

fastcgi_read_timeout 300;

fastcgi_buffer_size 64k;

fastcgi_buffers 4 64k;

fastcgi_busy_buffers_size 128k;

fastcgi_temp_file_write_size 256k;

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;

proxy_temp_path /opt/nginx/html/images/images_temp;

proxy_cache_path /opt/nginx/html/images/images_cache levels=1:2 keys_zone=content:200m inactive=1d max_size=30g;

gzip on;

gzip_min_length  1k;

gzip_buffers     4 16k;

gzip_http_version 1.0;

gzip_comp_level 2;

gzip_types       text/plain application/x-javascript text/css application/xml;

gzip_vary on;

gzip_proxied        expired no-cache no-store private auth;

gzip_disable        "MSIE [1-6]\.";

#limit_zone  crawler  $binary_remote_addr  10m;

server_tokens off;

#log format

log_format  access  '$remote_addr - $remote_user [$time_local] "$request" '

'$status $body_bytes_sent "$http_referer" '

'"$http_user_agent" $http_x_forwarded_for';

include vhost/cqnt.conf;

}

  1. 编译vhost/cqnt.conf

server

{

listen       80;

server_name images.lencee.com 192.168.0.107;

index index.html index.htm index.php default.html default.htm default.php;

root  /opt/app/img;

access_log /opt/nginx/logs/80pic.log access;

location ~ /purge(/.*){

allow 192.168.1.0/24;

deny       all;

proxy_cache_purge content $host$1$is_args$args;

}

location ~ .*\.(php|php5)?$

{

try_files $uri =404;

fastcgi_pass  unix:/tmp/php-cgi.sock;

fastcgi_index index.php;

#                      include fcgi.conf;

}

#        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$

location ~ .*\.(cgi|php|jsp|swf)?$

{

expires      30d;

proxy_cache content;

proxy_cache_valid 200 304 301 302 10d;

proxy_cache_valid any 1d;

proxy_set_header Host $host;

proxy_set_header X-Forwarded-For $remote_addr;

proxy_cache_key $host$uri$is_args$args;

proxy_pass http://192.168.0.107:8080;

}

location ~ .*\.(js|css)?$

{

expires      12h;

}

}

server

{

listen 8080;

server_name 192.168.0.107;

root /opt/nginx/img/;

location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$

{

expires      30d;

access_log  /opt/nginx/logs/8080pic.log access;

}

access_log on;

}

四、检查配置信息是否正确

五、启动Nginx服务

/etc/init.d/nginxd start

Ps –aux |grep nginx

六、手动清除图片缓存

Nginx 1.4.7图片缓存服务器的更多相关文章

  1. 用nginx图片缓存服务器

    图片的存储硬件 把图片存储到什么介质上? 如果有足够的资金购买专用的图片服务器硬件或者 NAS 设备,那么简单的很: 如果上述条件不具备,只想在普通的硬盘上存储,首先还是要考虑一下物理硬盘的实际处理能 ...

  2. Nginx 搭建图片缓存服务器-转

    文章:https://waver.me/2019/04/11/Nginx-Cache-Server/ 参考: Nginx 配置详解Nginx 简易教程Nginx 配置总结

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

    业务需求nginx对后端tomcat(静态文件)做缓存 减轻后端服务器的压力 # nginx-1.6.2.tar.gz  ngx_cache_purge-2.3.tar.gz #编译安装 ./conf ...

  4. 使用nginx缓存服务器上的静态文件

    一.nginx缓存的优点 如图所示,nginx缓存,可以在一定程度上,减少源服务器的处理请求压力. 因为静态文件(比如css,js, 图片)中,很多都是不经常更新的.nginx使用proxy_cach ...

  5. 使用Nginx反向代理和proxy_cache缓存搭建CDN服务器加快Web访问速度

    碰到问题:移动用户访问web服务器www.osyunwei.com很慢解决办法:1.在移动机房放置一台nginx反向代理服务器2.通过域名DNS智能解析,所有移动用户访问www.osyunwei.co ...

  6. nginx图片缓存服务器配置实战

     1.图片目录设置: 假定服务器主目录为nginx的默认目录:/usr/local/nginx-0.8.32/html/ 图片存放目录为:/usr/local/nginx-0.8.32/html/SD ...

  7. 5.Nginx作为web缓存服务器

    Nginx作为web缓存服务器 从0.7.48版本开始,Nginx支持类似Squid的缓存功能.Nginx的web缓存服务主要由proxy_cache相关命令集合fastcgi_cache相关命令集构 ...

  8. Linux下安装Nginx并配置一个图片服务器

    首先安装nginx安装环境 nginx是C语言开发,建议在linux上运行,本教程使用Centos6.5作为安装环境. gcc 安装nginx需要先将官网下载的源码进行编译,编译依赖gcc环境,如果没 ...

  9. 170522、Linux 平台通过 nginx 和 vsftpd 构建图片服务器

    Nginx WEB 服务器 Nginx 是一个高性能的 HTTP 和 反向代理 服务器,也是一个 IMAP/POP3/SMTP 代理服务器. Nginx 是由 Igor Sysoev 为俄罗斯访问量第 ...

随机推荐

  1. HTML5的manifest缓存

    要使用manifest缓存,我们首先需要写一个manifest文件.这个文件有严格的格式要求,下面是个例子CACHE MANIFEST#我是注释,这个文件名叫test.manifestCACHE:/t ...

  2. 【和我一起学python吧】初学Python,版本如何选择?

    早在四年多以前,在我进入英才网之前,去面试过一家海归创业的公司.他们需要的是有unix开发经验的技术人员,但是因为他们当时所处的阶段对很多成熟 技术人员不是很吸引,所以条件放宽为熟悉面向对象的程序开发 ...

  3. JQuery插件之图片轮播插件–slideBox

    来源:http://www.ido321.com/852.html 今天偶然发现了一个比较好用的图片轮播插件—slideBox 先看看效果:http://slidebox.sinaapp.com/ 代 ...

  4. MLE MAP EM

    1.最大似然估计 (MLE):  什么是最大似然估计?     问题:给定一组观察数据还有一个参数待定的模型,如何来估计这个未知参数呢? 观察数据(x1,y1)......(xn,yn)   待定模型 ...

  5. wine的中文字体显示

    从1.1.4开始wine的界面就已经支持中文了,但是对于软件中的中文支持并不太好,主要原因.还是字体...Let's go 首先,copy一下字体:把simsun.ttc (即宋体)复制到 ~/.wi ...

  6. JavaWeb应用中重定向与跳转的区别

    针对JSP与Servlet: 两种重要的跳转: 1.request.getRequestDispatcher("地址").forward(ServletRequest, Servl ...

  7. AVD设置屏幕大小

    相关资料: 1.http://jingyan.baidu.com/article/fedf0737775d2835ac897700.html

  8. LCD1602汉字、自定义字符取模

    用zimo221软件, 新建一个8*8的图像,留出左边3列,用右边5列点出自定义字符,选择取模方式C51,就可得到对应的编码 如下图:温度符号℃的编码

  9. [iOS UI进阶 - 6.3] UIView 动画

    1.UIView转场过渡动画   // // ViewController.m // UIViewAnimationTest // // Created by hellovoidworld on 15 ...

  10. ASP.NET MVC程序传值方式:ViewData,ViewBag,TempData和Session

    转载原地址 http://www.cnblogs.com/sunshineground/p/4350216.html 在ASP.NET MVC中,页面间Controller与View之间主要有以下几种 ...