lua-resty-qless-web UI 界面运行

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

posted on   荣锋亮  阅读(1335)  评论(0编辑  收藏  举报

编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
历史上的今天:
2018-01-04 riotjs 简单使用&&browserify 构建
2018-01-04 jspm 安装试用
2018-01-04 travis-cli 使用
2015-01-04 转 关于ruby gem无法连接到rubygems.org的解决方案

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示