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. MySQL压测中遇到的一些问题

    批量insert http://blog.csdn.net/xiaoxian8023/article/details/20155429 Mysql jdbc 批处理数据,需要给jdbc连接加上rewr ...

  2. POJ 1519 Digital Roots

    题意:求数根. 解法:一个数的数根就是mod9的值,0换成9,只是没想到给的是一个大数……只好先把每位都加起来再mod9…… 代码: #include<stdio.h> #include& ...

  3. UI篇--Android中TableLayout中的布局

        表格布局是按照行列来组织子视图的布局.表格布局包含一系列的Tablerow对象,用于定义行(也可以使用其它子对象).表格布局不为它的行.列和单元格显示表格线.每个行可以包含个以上(包括)的单元 ...

  4. How to enable DateTimePicker to use both date and time z

    Recently in one of my project I needed to have an option to display the DateTimePicker allowing user ...

  5. C# winform 若要在加载设计器前避免可能发生的数据丢失,必须纠正以下错误

    winform中有时添加了新控件之后编译会报错: 若要在加载设计器前避免可能发生的数据丢失,必须纠正以下错误,如图: 解决方案: 1.“解决方案”→“批生成”→“清理”→“确定”: 2.“解决方案”→ ...

  6. duilib中的V和H布局中滚动条问题

    转自博客:http://blog.csdn.net/damingg/article/details/41149037 首先看一段xml代码 [html] view plaincopy <?xml ...

  7. ubuntu安装nginx+php

    1.安装nginx aptitude search nginx sudo apt-get install nginx 2.安装php sudo apt-get install php5 sudo ap ...

  8. [LeetCode] Add Digits (a New question added)

    Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. ...

  9. Sql建表语句

    create table dbo.[Finance_CityInfo] ([CityId] int identity(1,1) not null , [City] nvarchar(20) not n ...

  10. 第二百九十六天 how can I 坚持

    今天果真好冷,至今遇到的最冷的一天,出去一趟,脸都快要冻瘫了. 感觉自己事真的多,找个对象还这事那事的,活该单身. 好愁人啊. 今天,魏中贺来北京,本来说的要明天聚聚,可是,都不给力啊,都不知道在忙啥 ...