openrestry 安装

1、 首先安装依赖

yum install readline-devel pcre-devel openssl-devel gcc

2、 编译安装

-- 1. 下载openresty源码: http://openresty.org/cn/download.html
$ wget https://openresty.org/download/openresty-1.9.7.4.tar.gz

-- 2. 解压tar包
$ tar xzvf openresty-1.9.7.4.tar.gz

-- 3. 配置编译选项,可以根据你的实际情况增加、减少相应的模块
$ ./configure --prefix=/opt/openresty --with-luajit --without-http_redis2_module --with-http_iconv_module

-- 4. 编译并安装
$ make
$ make install 

3、启动

-- 1. 修改配置文件如下:
$ cat /opt/openresty/nginx/conf/nginx.conf
worker_processes  1;
error_log logs/error.log info;

events {
    worker_connections 1024;
}

http {
    server {
        listen 8003;

        location / {
            content_by_lua 'ngx.say("hello world.")';
        }
    }
}

-- 2. 启动nginx
$ /opt/openresty/nginx/sbin/nginx

-- 3. 检查nginx
$ curl http://127.0.0.1:8003/
hello world.

4、 性能测试

-- 1. 安装压力测试工具
$ yum install httpd-tools

-- 2. 测试
$ ab -c10 -n50000 http://localhost:8003/
...
Concurrency Level:      10
Time taken for tests:   2.825 seconds
Complete requests:      50000
Failed requests:        0
Write errors:           0
Total transferred:      8050000 bytes
HTML transferred:       650000 bytes
Requests per second:    17697.26 [#/sec] (mean)
Time per request:       0.565 [ms] (mean)
Time per request:       0.057 [ms] (mean, across all concurrent requests)
Transfer rate:          2782.48 [Kbytes/sec] received
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值