码迷,mamicode.com
首页 > 其他好文 > 详细

openresty + lua+项目环境搭建

时间:2020-05-11 18:36:41      阅读:77      评论:0      收藏:0      [点我收藏+]

标签:绝对路径   type   clu   环境   模糊   include   就会   serve   openresty   

(1)openresty的安装参考上一篇博客https://www.cnblogs.com/first-semon/p/12858959.html

  openresty的安装路径默认实在/usr/local/openresty下

(2)在/usr/local/openresty/nginx/conf/nginx.conf 配置文件中加入lua相关的配置

在http中加如如下配置项:
 lua_package_path "/usr/local/openresty/lualib/?.lua;;";
 lua_package_cpath "/usr/local/openresty/lualib/?.so;;";

(3) 在openresty/conf目录下新建lua.conf。配置文件内容如下:

server {
    listen 90;
    server_name _;  
    location /lua {
          location /lua {
                        default_type text/html;
                        lua_code_cache off;
                        content_by_lua_file /usr/openResty/lua/test.lua;
                }

    }  
}

(4) 在openresty/nginx/conf/nginx.conf配置文件中的http部分加入

include   lua.conf

(5)使用/usr/local/openresty/nginx/sbin/nginx -t 测试是否正常

(6)先停止服务,在重启

停止服务:/usr/local/openresty/nignx/sbin/nginx -s stop

重启服务:/usr/local/openresty/nginx/sbin/nginx -c 项目的path+*.conf -p /usr/local/openresty/nginx/

 

说明:-c 项目所在的路径和项目的配置文件,本例中是/usr/local/openresty/nginx/conf/nginx.conf      

           -p /usr/local/openresty/nginx/      nginx的安装路径

(二)项目配置

当项目的lua文件越来越大,管理起来就会很麻烦。我们把原来的lua文件夹和lualib 一块移动到我们新建的路径下,然后修改nginx.conf中的内容和lua.conf配置,建议使用绝对路径。

特别说明:这里说的比较模糊,建议结合https://blog.csdn.net/meteor_93/article/details/94309027来实现环境的配置。

openresty + lua+项目环境搭建

标签:绝对路径   type   clu   环境   模糊   include   就会   serve   openresty   

原文地址:https://www.cnblogs.com/first-semon/p/12870420.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!