windows10下OpenResty环境配置

1、idea安装

2、配置idea插件,需要安装两个插件,lua(或者EmmyLua)和nginx Support

3、openresty

http://openresty.org/cn/download.html

4、解压openresty-1.13.6.2-win64.zip,双击nginx.exe,访问localhost如果看到hello openresty,则以安装完成

5、idea配置nginx server

nginx Executable : 选择安装openresty后nginx.exe

configuration File : nginx配置文件,可选择自己项目路径中的nginx.conf文件

Pid file :nginx 进程文件,可在自己项目路径中指定

安装之后运行,就可以通过idea启动nginx了,但是我们项目路径一般不再openresty下,所以需要把两个文件路径做个映射

6、文件路径映射

项目路径下创建ant需要的build.xml文件

<?xml version="1.0" encoding="UTF-8"?>

<project name="OpenResty" default="dist" basedir="D:/workspace/OpenResty">
    <description>
        run pic-server
    </description>
    <!-- set global properties for this build -->
    <property name="openresty-home" location="D:\openresty\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}/src"/>

    <echo>######开发版本的ant配置#####</echo>
    <target name="clean" depends="">
        <echo>清理openresty目录 ${dist}下的conf,logs,janus,januslib</echo>
        <delete dir="${target-conf}"/>
        <delete dir="${target-src}"/>
        <delete>
            <fileset dir="${openresty-home}/logs" includes="*.log">
            </fileset>
        </delete>
    </target>

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

    <target name="dist" 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>

修改basedir:项目跟路径

openresty-hemo:安装openresty的路径

7、添加ant

8、在nginx server配置中增加,使每次运行之前先执行ant,完成文件copy

需要注意区分两个路径,一个是自己项目的路径,另外一个是openresty的安装路径,我们喜欢将他们去跟开来,这样就需要每次执行前将自己项目路径中的src文件和nginx.conf文件copy到openresty的安装路径,上面ant配置就是为了完成这个。

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值