Coder Social home page Coder Social logo

lsp's Introduction

1、在ngx_lua的基础上,仿照jsp的标签方式,用lua实现的lsp( lua server page )
2、只实现了三个标签:<%=   %>  <% %>  <%include file=""%>
3、这个三个标签只简单的测试过,对标签中的出现的各种异常关未覆盖到。
4、urlconf是主入口,请按原来的例子配置
5、lsp文件按jsp的方式,会生成一lua文件,此版本如果lsp就有修改,不会自动更新lua文件,需要手工册work下对应的lua文件
6、对url的配置,参照Django,学其皮毛,形似

使用方法:
1、先ngx_lua安装,下载openresty,我的安装路/opt/openresty/;
2、把整个项目复制到/opt/openresty/nginx/conf/lua/下,目录结构如下
               lua
               ├─biz               #业务处理放的路径,不限定此文件夹名称,在urlconf中定义
               ├─lsp               #存放页面的地方,不限定此文件夹名称,在urlconf中定义
               │  ├─blog  
               │  └─sample
               ├─lsplib            #源代码
               └─work              #根据lsp生成的 lua文件,此文件名限定死,work文件夹权限需要777
                  ├─blog
                  └─sample

3、修改在/opt/openresty/nginx/conf/nginx.conf文件(详见代码中的nginx.conf文件),添加如下:
               env LSP_HOME=/opt/openresty/nginx/conf/lua;
    修改 lua_package_path '/opt/openresty/nginx/conf/lua/?.lua;;';
    加server中加下如下:
         location ~ ^/lua/(\w+) {
            default_type 'text/html';
	    content_by_lua_file conf/lua/urlconf.lua;
            lua_code_cache off;
   	 }

lsp's People

Watchers

 avatar

Forkers

cnnewjohn

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.