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. LightOJ 1038-Race to 1 Again(概率dp)

    题意: 给你一个数n每一步这个数可以变为他的因子,直到这个数变为1,求n变到1的期望步数. 分析: dp[i],表示i变为1的期望步数,dp[1]=0,dp[n]是答案. dp[i]=sum(dp[j ...

  2. Selenium2Library系列 keywords 之 _SelectElementKeywords 之 get_selected_list_value(self, locator)

    def get_selected_list_value(self, locator): """Returns the value of the selected elem ...

  3. XShell 屏幕锁定的恢复方法(Ctrl+Q)

    操作XShell过程中很多时间大家会习惯性的按Ctrl+S进行保存. Ctrl+S在XShell的作用是屏幕锁定,很多朋友会无法操作,会直接把窗口关闭. 解决方法: 快捷键 Ctrl+Q 即能完成解锁 ...

  4. 【跟我一起学Python吧】python with statement 进阶理解

    由于之前有一个项目老是要打开文件,然后用pickle.load(file),再处理...最后要关闭文件,所以觉得有点繁琐,代码也不简洁.所以向python with statement寻求解决方法.以 ...

  5. String比较

    String str1 = "abc"; String str2 = "abc"; String str3 = new String("abc&quo ...

  6. Uva 208 - Firetruck

    [题目链接]http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&p ...

  7. 修改MongoDb的 DB 和 Log 存储路径 (Windows)-摘自网络

    Create a file called mongod.cfg in MongoDB folder if you dont have it. In my case: C:\Users\ivanbtru ...

  8. 让UITableViewCell的分隔线宽度等于屏幕的宽度

    3种方法: 1.自定义cell: 1).取消系统的分隔线 2).添加一个高度为1,宽度为屏幕宽度的UIView作为cell的子视图,通过设置frame或者约束使这个UIView始终在cell的底部 3 ...

  9. Spring AOP Example – Pointcut , Advisor

    In last Spring AOP advice examples, the entire methods of a class are intercepted automatically. But ...

  10. C语言简单实现sizeof功能代码

    sizeof不是函数,而是运算符,C/C++语言编译器在预编译阶段的时候就已经处理完了sizeof的问题,也就是说sizeof类似于宏定义. 下面给出一个sizeof的一个宏定义实现版本 #defin ...