zoukankan      html  css  js  c++  java
  • 使用ZeroBrane Studio调试Openresty lua脚本

    介绍

    ZeroBraneStudio 作为轻量级、跨平台的Lua IDE,已被广泛用来调试各种Lua引擎游戏框架、Openresty、Wireshark脚本等等。

    Openresty 是一个建立在Nginx Web应用服务器,一个非常快的Web服务器,提供非阻塞IO(各种后端redis、memcached、MySQL、HTTP服务器等)和支持Lua作为其脚本语言。


    目的

    本文旨在帮助初涉Openresty开发的相关开发人员了解如何使用ZeroBraneStudio开发和调试自己的lua脚步

    如下按照2个步骤说明:

    1、安装Openresty和ZeroBrane Studio

    2、编写简单Openresty脚步并进行调试


    安装Openresty和ZeroBrane Studio

    1、Openresty安装

    Openresty提供多种安装方式(http://openresty.org/cn/installation.html),在unix系统上我们可以直接使用官方提供的预编译包直接安装,使用windows的同学可以直接下载exe运行(http://openresty.org/cn/download.html)。

    2、ZeroBraneStudio安装

    从https://github.com/pkulchenko/ZeroBraneStudio/releases下载发布包并解压,运行zbstudio.exe or zbstudio.sh打开ZeroBraneStudio,同时点击Project->Project Directory选择Openresty目录。


    编写简单Openresty脚步并进行调试

    我们首先更改openresty配置如下:

    worker_processes  auto;
    
    worker_rlimit_nofile 65535;
    
    events {
        worker_connections 20480;
    }
    
    http {
        include       mime.types;
        default_type  application/octet-stream;
        sendfile        on;
        keepalive_timeout  65;
        limit_req_zone $binary_remote_addr zone=one:50m rate=20r/s;
    
        lua_package_path 'D:eroBraneStudio-1.70/lualibs/?/?.lua;D:eroBraneStudio-1.70/lualibs/?.lua;;';
        lua_package_cpath 'D:eroBraneStudio-1.70/bin/clibs/?.dll;;';
        
        include server.conf;
    }
    
        server {
            listen 80;
    
    
            location /helloworld {
                default_type text/plain;
                content_by_lua_file D:openresty-1.13.6.1-win32luacontent.lua;
            }
        }

    然后运行nginx.exe启动Openresty,点击Project | Start Debugger Server启动Debugger Server,在浏览器输入http://localhost/helloworld,然后即可进入断点调试

    (If you are running on OSX, replace ?.dll with ?.dylib and if you are running on Linux, replace bin/clibs/?.dll with either bin/linux/x86/clibs/?.so or bin/linux/x64/clibs/?.so depending on your platform.)

  • 相关阅读:
    spring boot下WebSocket消息推送(转)
    实时Web的发展历史
    mysqldump使用大全
    MYSQLDUMP参数详解(转)
    springboot页面缓存和url缓存实例
    在linux下运行jmeter
    jmeter测试http请求使用csv参数
    maven分开打包jar文件和依赖jar包和资源文件
    log4j DatePattern 解惑
    log4j使用示例
  • 原文地址:https://www.cnblogs.com/caozhiyuan/p/9425088.html
Copyright © 2011-2022 走看看