idea+openresty+lua开发环境搭建


环境准备: 
idea 插件安装: OpenResty Lua Support,Lua,Nginx Support (若国内无法下载,请自行翻墙)
大致思路:配置nginx_server(即openresty路径下nginx) 在idea上编写lua脚本,通过ant将代码及配置文件复制到openresty路径下
环境配置
1.创建maven工程:
2.配置nginx
 
3.配置ant:
注:此处主要复制lua脚本到openresty路径下
 
1.在项目根路径下创建build.xml配置文件
<?xml version="1.0" encoding="UTF-8"?>
<!-- 项目路径 -->
<project name="openResty" default="copy" basedir=".">
    <description>
        run nginx-server
    </description>
    <!-- set global properties for this build -->
    <property name="openresty-home" location="D:\dev_software\openresty-1.13.6.2-win64"/>
    <property name="conf" location="${basedir}/conf"/>
    <property name="src" location="${basedir}/src"/>
    <property name="target-conf" location="${openresty-home}/conf"/>
    <property name="target-src" location="${openresty-home}/${ant.project.name}"/>

    <target name="clean" depends="">
        <echo>清理openresty目录 ${dist}下的conf,logs,janus,januslib</echo>
        <delete file="${target-conf}/nginx.conf"/>
        <delete dir="${target-src}"/>
    </target>

    <target name="init" depends="clean">
        <!--<echo>创建安装目录</echo>-->
        <!--<mkdir dir="${target-conf}"/>-->
        <mkdir dir="${target-src}"/>
    </target>

    <target name="copy" depends="init" description="generate the distribution" >
        <echo>复制安装文件</echo>
        <copy todir="${target-conf}">
            <fileset dir="${conf}"></fileset>
        </copy>
        <copy todir="${target-src}">
            <fileset dir="${src}"></fileset>
        </copy>
    </target>

</project>
该配置文件主要配置openresty工作路径,及idea工程配置文件路径
2.ant配置build.xml
 
 
3.将ant插件与nginx插件关联起来:
 
 
4.配置nginx 日志路径,以便在idea控制台查看
 
5.手动执行ant命令,查看效果,正常情况下可以看到idea src目录下代码被copy到openresty路径下
 
6.nginx.conf文件中配置lua路径:此处使用相对路径
7.启动nginx


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM