微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

openresty centos下开发环境安装

  1. 安装依赖的软件包
  2. yum install readline-devel pcre-devel openssl-devel gcc
  3. 安装openresty
  4. `– 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
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.
```性能测试





<div class="se-preview-section-delimiter"></div>

– 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

“`
转自 http://www.jb51.cc/article/p-xkdcovmb-bmd.html
ref

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

原文地址:https://www.jb51.cc/centos/376124.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。