9.nginx using Redis Cache

Source: Internet
Author: User

Need to use the third-party module, because in Youdao notes above, so for the method directly to you, need to give me a private message or mail ([email protected])

1. Compile the installation and add the above extensions./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. modifying nginx.conf configuration Location ~. *\.php {  root html;                srcache_store_private on;                Srcache_metho DS get;                Srcache_response_cache_control off;     &nbs P             if ($uri ~. *\.php$) {                        set $key $request _uri;                    &N Bsp   Set_escape_uri $escaped _key $key;                      &NBSP ; Srcache_fetch Get/redis $key;                        srcache_ Default_expire 172800;                        Srcache_store PU T/redis2 key= $escaped _key&exptime= $srcache _expire; }                Include fastcgi_params;                Fastcgi_pass  127.0.0.1:9000;  & nbsp             Fastcgi_index index.php;                Fastcgi_connect_timeout 60;                Fastcgi_send_timeout 180;               fastcgi_read_timeout 180;                Fastcgi_buffe R_size 128k;                Fastcgi_buffers 4 256k;        &NB Sp       Fastcgi_busy_buffers_size 256k;                Fastcgi_temp_f Ile_write_size 256k;                fastcgi_intercept_errors on;    &nbs P           Fastcgi_param  script_filename   $document _root$fastcgi_script_name;                 Fastcgi_split_path_info ^ (. +\.php) (. *) $;      &NBSP ;         Fastcgi_param path_info $fastcgi _path_info;         }   &N Bsp     location =/redis {                internal;      &NB Sp     &NBSp   SET_MD5 $redis _key $args;                Redis2_pass 127.0.0.1:6379;       }         location =/redis2 {            &NBS P   internal;                 Set_unescape_uri $exptime $arg _exptime;&nbs P               Set_unescape_uri $key $arg _key;                SET_MD5 $key;                 Redis2_query set $key $echo _reque st_body;                redis2_query expire $key $exptime;      &NB Sp         Redis2_pass 127.0.0.1:6379;       } 3. Redis checks if a key value is generated Redis-clikeys *infodbsize

9.nginx using Redis Cache

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.