Linux 运维:Nginx-Openresty和Nginx-tomcat

一、Openresty

1、编译、安装opesresty
[root@server1 ~]# tar zxf openresty-1.13.6.1.tar.gz 
[root@server1 ~]# cd openresty-1.13.6.1
[root@server1 openresty-1.13.6.1]# ./configure --prefix=/usr/local/lnmp/openresty
[root@server1 openresty-1.13.6.1]# gmake && gmake instal
2、配置文件
[root@server1 ~]# vim /usr/local/lnmp/openresty/nginx/conf/nginx.conf

 19         upstream memcache {
 20                 server 172.25.12.1:11211;
 21                 keepalive 512;
 22         }

 53         location /memc {
 54         internal;
 55         memc_connect_timeout 100ms;
 56         memc_send_timeout 100ms;
 57         memc_read_timeout 100ms;
 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        #     fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
 88             include        fastcgi.conf;
 89         }
3、打开 memcached、php-fpm、nginx
  • 有关memcached和php的配置,欢迎浏览我的LNMP(Nginx+Mysql+Php)博客这里不再赘述,敬请谅解
[root@server1 ~]# /etc/init.d/memcached start
Starting memcached:                                        [  OK  ]
[root@server1 ~]# /etc/init.d/php-fpm start
Starting php-fpm  done
##Server1主机已经配置过nginx,所以这里启动openresty采用绝对路径
[root@server1 ~]# /usr/local/lnmp/openresty/nginx/sbin/nginx 
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 [#/sec] (mean)

[kiosk@foundation12 Desktop]$ ab -c 1 -n 1000 http://172.25.12.1/index.php

Time taken 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值