#####################Openresty(nginx增强版)########################
***先关闭前面的nginx
nginx -s stop
安装包:openresty-1.11.2.3.tar.gz
解压:tar zxf openresty-1.11.2.3.tar.gz
cd openresty-1.11.2.3/
进行源码安装:.configure
编译,安装:
gmake && gmake install
编写配置文件:
cd /usr/local/openresty/nginx/conf/
vim nginx.conf
2 user nginx; ##用户为nginx
3 worker_processes 1;
12 events {
13 worker_connections 65535;
14 }
17 http {
18
19 upstream memcache {
20 server172.25.90.1:11211;
21 keepalive 512;
22 }
61 location /memc {
61 location /memc {
62 internal;
63 memc_connect_timeout100ms;
64 memc_send_timeout100ms;
65 memc_read_timeout 100ms;
66 set $memc_key$query_string;
67 set $memc_exptime300;
68 memc_passmemcache;
69 }
78 location ~ \.php$ {
79 set $key $uri$args;
80 srcache_fetch GET /memc$key;
81 srcache_store PUT /memc$key;
82 root html;
83 fastcgi_pass 127.0.0.1:9000;
84 fastcgi_index index.php;
85 # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
86 include fastcgi.conf;
cd /usr/local/openresty/nginx/sbin
./nginx
测试;
命令行: ab -c10 -n 5000 http://172.25.90.1/index.php
如图十一:
关闭openresty下的nginx
开启/lnmp下的nginx:
vim nginx.conf
2 user nginx;
3 worker_processes 1;
12 events {
13 worker_connections 65535;
14 }
测试:
命令行: ab -c10 -n 5000 http://172.25.90.1/index.php
如图十二: