• 使用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.)

  • 相关阅读:
    aspscheduler+uwsgi定时任务执行多次
    django定时任务
    django记录用户操作模块
    python缩小图片
    pymysql同时执行多条语句时报错
    MySQL8.0 修改密码
    linux中安装python3
    Mysql高性能
    Mysql高性能
    Mysql高性能
  • 原文地址:https://www.cnblogs.com/caozhiyuan/p/9425088.html
Copyright © 2020-2023  润新知