一、Openresty
1、编译、安装opesresty
[root@server1 ~]
[root@server1 ~]
[root@server1 openresty-1.13 .6.1 ]
[root@server1 openresty-1.13 .6.1 ]
2、配置文件
[root@server1 ~]
19 upstream memcache {
20 server 172.25 .12.1 :11211 ;
21 keepalive 512 ;
22 }
53 location /memc {
54 internal;
55 memc_connect_timeout 100 ms;
56 memc_send_timeout 100 ms;
57 memc_read _timeout 100 ms;
58 set $memc_key $query_string ;
59 set $memc_exptime 300 ;
60 memc_pass memcache;
61 }
80 location ~ \.php$ {
81 set $key $uri $args ;
82 srcache_fetch GET /memc $key ;
83 srcache_store PUT /memc $key ;
84 root html;
85 fastcgi_pass 127.0 .0.1 :9000 ;
86 fastcgi_index index.php;
87
88 include fastcgi.conf;
89 }
3、打开 memcached、php-fpm、nginx
有关memcached和php的配置,欢迎浏览我的LNMP(Nginx+Mysql+Php)博客这里不再赘述,敬请谅解
[root@server1 ~]
Starting memcached: [ OK ]
[root@server1 ~]
Starting php-fpm done
[root@server1 ~]
4、物理主机测试
Nginx 没有添加 Memcache 模块,Php有 Memcache 模块
[kiosk@foundation12 Desktop ]$ ab -c 1 -n 1000 http: //172.25.12.1/example .php
Time taken for tests: 0 .762 seconds
Complete requests: 1000
Failed requests: 0
Write errors: 0
Requests per second: 1728.62 [
[kiosk@foundation12 Desktop ]$ ab -c 1 -n 1000 http: //172.25.12.1/index .php
Time taken