zoukankan      html  css  js  c++  java
  • openresty + lua+项目环境搭建

    (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来实现环境的配置。

    作者:first_semon
             
    本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。如有问题,欢迎交流
  • 相关阅读:
    中间件面试总结
    1.angular js 学习网址
    摄影构图
    mybatis学习(四)
    mybatis学习(三)
    mybatis学习(二)
    mybatis 学习(一)
    mysql 使用过程中出现问题
    springboot
    java 关键字
  • 原文地址:https://www.cnblogs.com/first-semon/p/12870420.html
Copyright © 2011-2022 走看看