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. [Everyday Mathematics]20150109

    设 $A$ 是 $n$ 阶复方阵, 其特征多项式为 $$\bex f(\lm)=(\lm-\lm_1)^{n_1}\cdots(x-\lm_s)^{n_s}, \eex$$ 其中 $\lm_i$ 互不 ...

  2. 浅析基层检察院派驻乡镇检察室的健康发展 z

    时间:2011-03-22 10:08 作者:祝志方 新闻来源:正义网 一.前言 在我国,基层检察院派驻乡镇检察室的发展经过了一个曲折发展的历程,上世纪80年代,随着经济社会的发展,一批乡镇检察室应运 ...

  3. PHP学习笔记--文件目录操作(文件上传实例)

    文件操作是每个语言必须有的,不仅仅局限于PHP,这里我们就仅用PHP进行讲解 php的文件高级操作和文件上传实例我放在文章的最后部分.--以后我还会给大家写一个PHP类似于网盘操作的例子 注意:阅读此 ...

  4. IOS CAShapeLayer CAGradientLayer UIBezierPath 使用实例

    CGRect rect = CGRectMake(100, 100, 100, 100); UIView * bgView = [[UIView alloc]initWithFrame:rect]; ...

  5. 第2课 讲解主流三大web服务器之Apache服务器(httpd服务器) - 大型网站高并发架构与自动化运维实战(六)

    基本配置 配置固定IP地址 打开默认的网卡配置文件 cd /etc/sysconfig/network-script/ cp ifcfg-eth0 ifcfg-eth1 vim ifcfg-eth0 ...

  6. Stunnix C++ Obfuscator使用简介

    因为项目的需求,需要混淆C代码.目前.net和java混淆工具很好用.但是c混淆工具不多.找到一个Stunnix C++ Obfuscator http://www.stunnix.com/网上很少有 ...

  7. linux内核书籍

    1, 关于操作系统理论的最初级的知识.不需要通读并理解<操作系统概念><现代操作系统>等巨著,但总要知道分时(time-shared)和实时(real-time)的区别是什么, ...

  8. c函数习记

    1,user groups 篇幅 the length of an article; fgetgrent(从指定的文件来读取组格式) 相关related functions;fgetpwent hea ...

  9. 【转】浅析C语言的非局部跳转:setjmp和longjmp

    转自 http://www.cnblogs.com/lienhua34/archive/2012/04/22/2464859.html C语言中有一个goto语句,其可以结合标号实现函数内部的任意跳转 ...

  10. JSF 2 multiple select listbox example

    In JSF, <h:selectManyListbox /> tag is used to render a multiple select listbox – HTML select ...