• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

lua-resty-qless-webUI界面运行

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

lua-resty-qless-web 是 lua-resty-qless 的web 管理界面以及lua-resty-template 模版引擎开发的,里面实现了一个简单的
路由功能
备注: demo 运行使用docker-compose ,简单修改了官方demo 有问题的部分,后边会添加集成lua-resty-qless 的docker-compose
运行方式

环境准备

  • docker-compose 文件
 
version: "3"
services:
  app:
    build: ./
    ports:
    - "8080:80"
    volumes:
    - "./app/:/opt/app/"
    - "./nginx.conf:/usr/local/openresty/nginx/conf/nginx.conf"
  redis:
    image: redis
    ports:
    - "6379:6379"
 
 
  • nginx 配置
worker_processes 1;
user root;  
events {
    worker_connections 1024;
}
http {
    include mime.types;
    default_type application/octet-stream;
    sendfile on;
    keepalive_timeout 65;
    lua_code_cache off;
    gzip on;
    resolver 127.0.0.11;          
    real_ip_header X-Forwarded-For;
    real_ip_recursive on;
    lua_package_path '/opt/app/lua-resty-qless-web/lib/?.lua;;';
    init_by_lua_block {
      local Qless_Web = require("resty.qless-web")
    }
    server {
        listen 80;
        server_name localhost;
        charset utf-8;
        root html;
        default_type text/html;
       # 配置web 
        location /web {
          default_type text/html;
          location /web/__static {
              internal;
              rewrite ^/web/__static(.*) $1 break;
              root /opt/app/lua-resty-qless-web/static/;
          }
          content_by_lua_block {
              local resty_qless = require "resty.qless"
              local qless, err = resty_qless.new({
                host = "redis",
                port = 6379,
               })
              if not qless then
                 return ngx.say("Qless.new(): ", err)
              end
              local Qless_Web = require("resty.qless-web")
              local web = Qless_Web:new({ client = qless, uri_prefix = "/web" })
              web:run()
          }  
        }
        location / {
           default_type text/html;
           index index.html;
        }
        error_page 500 502 503 504 /50x.html;
        location = /50x.html {
            root html;
        }
    }
}
 
  • lua-resty-qless-web 代码
    此代码直接从github clone,使用中需要配置lua 包的位置,在nginx.conf 中
    lua_package_path '/opt/app/lua-resty-qless-web/lib/?.lua;;';

运行&&界面

  • 启动
 
docker-compose up -d
 

参考资料

https://github.com/rongfengliang/lua-resty-qless-web-docker-compose
https://github.com/ledgetech/lua-resty-qless
https://github.com/hamishforbes/lua-resty-qless-web


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
cocos2d-lua中的弧度和角度发布时间:2022-07-22
下一篇:
lua coroutine发布时间:2022-07-22
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap