zoukankan      html  css  js  c++  java
  • 9.nginx使用redis用缓存

    需要使用到的第三方模块,因为在有道笔记上面,所以为办法直接给你们,需要的话给我私信或者邮件(913956964@qq.com)

    1.编译安装,添加上述扩展插件
    ./configure --prefix=/usr/local/nginx --without-http_memcached_module --user=www --group=www --with-http_stub_status_module --with-openssl=/usr/ --with-pcre=/usr/local/src/pcre-8.31 --with-http_stub_status_module --add-module=/usr/local/src/ngx_devel_kit-master --add-module=/usr/local/src/set-misc-nginx-module-0.29 --add-module=/usr/local/src/srcache-nginx-module-0.30 --add-module=/usr/local/src/redis2-nginx-module-0.12 --add-module=/usr/local/src/echo-nginx-module-0.58
     
    2.修改nginx.conf配置
    location ~ .*.php {
      root html;
                    srcache_store_private on;
                    srcache_methods GET;
                    srcache_response_cache_control off;
       
                    if ($uri ~ .*.php$){
                            set $key $request_uri;
                            set_escape_uri $escaped_key $key;
                            srcache_fetch GET /redis $key;
                            srcache_default_expire 172800;
                            srcache_store PUT /redis2 key=$escaped_key&exptime=$srcache_expire;
     }
                    include fastcgi_params;
                    fastcgi_pass  127.0.0.1:9000;
                    fastcgi_index index.php;
                    fastcgi_connect_timeout 60;
                    fastcgi_send_timeout 180;
                    fastcgi_read_timeout 180;
                    fastcgi_buffer_size 128k;
                    fastcgi_buffers 4 256k;
                    fastcgi_busy_buffers_size 256k;
                    fastcgi_temp_file_write_size 256k;
                    fastcgi_intercept_errors on;
                    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
                    fastcgi_split_path_info ^(.+.php)(.*)$;
                    fastcgi_param PATH_INFO $fastcgi_path_info;
             }
     
            location = /redis {
                    internal;
                    set_md5 $redis_key $args;
                    redis2_pass 127.0.0.1:6379;
            }
     
            location = /redis2 {
                    internal;
     
                    set_unescape_uri $exptime $arg_exptime;
                    set_unescape_uri $key $arg_key;
                    set_md5 $key;
     
                    redis2_query set $key $echo_request_body;
                    redis2_query expire $key $exptime;
                    redis2_pass 127.0.0.1:6379;
            }
     
    3.redis检查是否产生key值
    redis-cli
    keys *
    info
    dbsize
    每天学习一点点,重在积累!
  • 相关阅读:
    js中调用ocx控件
    web.xml配置文件中<async-supported>true</async-supported>报错的解决方案
    shiro整合spring配置
    shiro中的reaml理解及实现机制
    oracle数据库安装
    关于身份认证、角色认证和权限认证的shiro-web例子
    创建maven管理的web项目
    hadoop Hive 的建表 和导入导出及索引视图
    hadoop Mapreduce组件介绍
    hadoop hive组件介绍及常用cli命令
  • 原文地址:https://www.cnblogs.com/GXLo/p/5169160.html
Copyright © 2011-2022 走看看