zoukankan      html  css  js  c++  java
  • 基于centos7源码编译openresty

    概述

      基于源码构建openresty,为后续编写lua嵌入式脚本提供测试环境。OpenResty® 是一个基于 Nginx 与 Lua 的高性能 Web 平台,其内部集成了大量精良的 Lua 库、第三方模块以及大多数的依赖项。用于方便地搭建能够处理超高并发、扩展性极高的动态 Web 应用、Web 服务和动态网关。

    环境:

    centos7 x86_64

    openresty-1.15.8.1.tar.gz

    下载

    http://openresty.org/cn/

    http://openresty.org/cn/download.html

    https://openresty.org/download/openresty-1.15.8.1.tar.gz

    http://openresty.org/cn/components.html   ###lua给nginx扩展的lua插件,实现更多协议及应用的负载

    依赖

    注意:openresty是基于ningx上嵌入lua的解释器支持插件的拓展

    yum install -y gcc make pcre-devel openssl-devel zlib-devel

    tar xf openresty-1.15.8.1.tar.gz

    编译

    [root@c_3 openresty-1.15.8.2]# ./configure --prefix=/opt/openresty

    [root@c_3 openresty-1.15.8.2]# make -s -j2
    ==== Building LuaJIT 2.1.0-beta3 ====
    ==== Successfully built LuaJIT 2.1.0-beta3 ====

    [root@c_3 openresty-1.15.8.2]#
    [root@c_3 openresty-1.15.8.2]# make -s install
    ==== Building LuaJIT 2.1.0-beta3 ====
    ==== Successfully built LuaJIT 2.1.0-beta3 ====
    ==== Installing LuaJIT 2.1.0-beta3 to /opt/openresty/luajit ====
    ==== Successfully installed LuaJIT 2.1.0-beta3 to /opt/openresty/luajit ====

     

    测试

    [root@c_3 openresty]# ./bin/openresty -v
    nginx version: openresty/1.15.8.2
    [root@c_3 openresty]# ./bin/openresty -V ###默认编译自动编译的参数
    nginx version: openresty/1.15.8.2

    ###nginx_lua.conf
    
    worker_processes  1;
    error_log logs/error.log;
    events {
        worker_connections 1024;
    }
    http {
        server {
            listen 8080;
            location / {
                default_type text/html;
                content_by_lua_block {
                    ngx.say("<p>hello, world</p>")
                }
            }
        }
    }

    测试配置文件及启动服务

    [root@c_3 openresty]# ./bin/openresty -c /opt/openresty/conf/nginx_lua.conf  -t   ###openresty软连接nginx/sbin/nginx
    nginx: the configuration file /opt/openresty/conf/nginx_lua.conf syntax is ok
    nginx: configuration file /opt/openresty/conf/nginx_lua.conf test is successful
    
    [root@c_3 openresty]# ./bin/openresty -c /opt/openresty/conf/nginx_lua.conf   ###启动服务
    [root@c_3 openresty]# ps -ef |grep nginx 
    root      10398      1  0 04:28 ?        00:00:00 nginx: master process ./bin/openresty -
    nobody    10399  10398  0 04:28 ?        00:00:00 nginx: worker process
    root      10424      1  0 04:33 ?        00:00:00 nginx: master process ./bin/openresty -c /opt/openresty/conf/nginx_
    lua.confnobody    10425  10424  0 04:33 ?        00:00:00 nginx: worker process
    root      10427  10362  0 04:33 pts/1    00:00:00 grep --color=auto nginx
    [root@c_3 openresty]# 
    [root@c_3 openresty]# ss -lnt
    State       Recv-Q Send-Q             Local Address:Port                            Peer Address:Port              
    LISTEN      0      128                            *:8080                                       *:*                  
    LISTEN      0      128                            *:80                                         *:*                  
    LISTEN      0      128                            *:22                                         *:*                  
    LISTEN      0      128                           :::2375                                      :::*                  
    LISTEN      0      128                           :::22                                        :::*                  
    [root@c_3 openresty]# curl 127.0.0.1:8080/   ###正常响应
    <p>hello, world</p> 
  • 相关阅读:
    WCF寻址
    WCF之多个协定
    WCF之多个终结点
    WCF客户端和服务端配置
    VS2012新建项目出错:未找到与约束ContractName Microsoft.VisualStudio.Text.ITextDocumentFactoryService
    windows运行打开服务命令
    Android中 服务里的方法抽取成接口
    Android Studio 使用genymotion 模拟器运行app时 提示找不到任何设备
    SVN 首次用TortoiseSVN Checkout 提示Unexpected HTTP status 405
    jQuery EasyUI -onblu、onkeyup等事件
  • 原文地址:https://www.cnblogs.com/xiaochina/p/12340598.html
Copyright © 2011-2022 走看看