美文网首页
centos 安装openresty

centos 安装openresty

作者: 林小姐的那片海 | 来源:发表于2018-05-15 10:08 被阅读0次

1. 安装依赖的软件包

/usr/bin/env: perl: No such file or directory出现这种错误可能是没有安装prel

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

2. 安装openresty

-- 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. HelloWorld

-- 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
...

ref

http://openresty.org/cn/installation.html
http://openresty.org/cn/getting-started.html
http://openresty.org/cn/using-luarocks.html

相关文章

  • openresty

    1、openResty安装 centos 安装 2、openresty配置 nginx匹配规则 服务端获得客户端...

  • nginx openresty

    openResty安装 centos 添加yum仓库,安装 openresty配置 服务端获得客户端的真实ip ...

  • OpenResty源码安装

    本文是在CentOS7.4环境下安装OpenResty 下载 OpenResty下载地址[https://open...

  • apioak安装使用教程

    centos 7 安装apioak 安装 OpenResty 和其他必需的依赖项 安装MariaDB 安装aoio...

  • centos 安装openresty

    1. 安装依赖的软件包 /usr/bin/env: perl: No such file or directory...

  • centos 安装OpenResty

    一、安装准备 安装OpenResty之前,您必须将这些库 perl 5.6.1+, libreadline, li...

  • CentOS安装OpenResty

    源码包编译安装 下载 从下载页Download下载最新的 OpenResty®源码包,并且像下面的示例一样将其解压...

  • CentOS 安装openresty

    下载openresty 的repo库 移动repo库文件到yum的repo库中 更新 安装openresty 启动...

  • kong、konga源码安装笔记

    安装环境 依赖:centos 7.5kong:1.2.1lua: 2.0.5openresty: 1.13.6.2...

  • openresty起步

    openresty 安装openresty 1、源码安装 安装前准备: 源码下载地址:openresty 解压、安...

网友评论

      本文标题:centos 安装openresty

      本文链接:https://www.haomeiwen.com/subject/iwkedftx.html