Nginx缓存配置及nginx ngx_cache_purge模块的使用
2017-10-20 11:51
567 查看
1.安装nginx相关依赖环境
2.下载ngx_cache_purge-2.3缓存模块
3.安装nginx并添加缓存模块
4.检查是否安装成功
5.配置nginx
yum groupinstall "Development Tools" yum install pcre-devel zlib-devel openssl-devel
2.下载ngx_cache_purge-2.3缓存模块
wget -O /usr/src/ngx_cache_purge-2.3.tar.gz http://labs.frickle.com/files/ngx_cache_purge-2.3.tar.gz tar xfvz ngx_cache_purge-2.3.tar.gz
3.安装nginx并添加缓存模块
wget http://nginx.org/download/nginx-1.6.0.tar.gz tar -xzf nginx-1.6.0.tar.gz ./configure --sbin-path=/usr/sbin --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --pid-path=/var/run/nginx.pid --lock-path=/var/lock/nginx.lock --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/lib/nginx/body --http-proxy-temp-path=/var/lib/nginx/proxy --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --with-debug --with-http_stub_status_module --with-http_flv_module --with-http_ssl_module --with-http_dav_module --with-ipv6 --add-module=/usr/src/ngx_cache_purge-2.3 make && make install
4.检查是否安装成功
[root@vm10-20-10-32 ~]# nginx -V nginx version: nginx/1.13.6 built by gcc 4.4.7 20120313 (Red Hat 4.4.7-4) (GCC) built with OpenSSL 1.0.1e-fips 11 Feb 2013 TLS SNI support enabled configure arguments: --sbin-path=/usr/sbin --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --pid-path=/var/run/nginx.pid --lock-path=/var/lock/nginx.lock --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/lib/nginx/body --http-proxy-temp-path=/var/lib/nginx/proxy --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --with-debug --with-http_stub_status_module --with-http_flv_module --with-http_ssl_module --with-http_dav_module --with-ipv6 --add-module=/usr/src/ngx_cache_purge-2.3
5.配置nginx
proxy_cache_path /usr/local/nginx/proxy_cache_dir levels=1:2 keys_zone=cache1:200m inactive=5m max_size=1g; server { listen 80; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { proxy_pass http://localhost.com; } location ~ /purge(/.*) { proxy_cache_purge cache1 $host$1$is_args$args; } location ~ .*\.html$ { proxy_set_header Host $host; proxy_set_header X-Forwarded-For $remote_addr; proxy_pass http://localhost.com; proxy_cache cache1; #设置资源缓存的zone proxy_cache_key $host$uri$is_args$args; #设置缓存的key,以域名、URI、参数组合成Web缓存的Key值,Nginx根据Key值哈希,存储缓存内容到二级缓存目录内 proxy_cache_valid 200 304 5m; access_log logs/cache.log main; }
相关文章推荐
- Nginx缓存配置以及nginx ngx_cache_purge模块的使用
- Nginx缓存配置及nginx ngx_cache_purge模块的使用
- nginx缓存配置和ngx_cache_purge总结
- nginx的cache_purge模块及支持squidclient刷新的配置
- nginx的cache_purge模块及支持squidclient刷新的配置
- nginx 使用ngx_cache_purge清除缓存
- rails应用在passenger + nginx服务器下使用proxy_cache及proxy_cache_purge模块的方法
- Nginx反向代理和缓存服务和手动清除缓存模块purge的配置
- nginx安装第三方ngx_cache_purge模块,purge命令清除静态缓存
- nginx缓存配置和ngx_cache_purge总结
- nginx反向代理,动静态请求分离,以及nginx缓存应用,以及使用ngx_cache_purge清除指定URL
- FastDFS的配置、部署与API使用解读(7)Nginx的FastDFS模块
- 高性能Web服务器Nginx的配置与部署研究(13)应用模块之Memcached模块+Proxy_Cache双层缓存模式
- nginx使用ssl模块配置HTTPS支持
- nginx+php的配置(使用nginx的fastcgi模块)
- nginx 无 ngx_cache_purge 模块时的刷新方法
- nginx使用ssl模块配置HTTPS支持
- nginx 无 ngx_cache_purge 模块时的刷新方法(awk/python)
- 使用Nginx的proxy_cache缓存功能取代Squid
- 高性能Web服务器Nginx的配置与部署研究(12)应用模块之Memcached做文件缓存时压缩引起的问题