openresty开发环境搭建_openresty 开发环境搭建

  • nginx_supports
  • openresty_lua_supports

HelloWorld

新建一个Lua项目

在这里插入图片描述
名称为demo01
新建conf目录nginx.conftest.luabuild.xml
在这里插入图片描述

  • nginx.conf
worker_processes  2;
error_log  logs/error.log  info;
events {
    worker_connections  1024;
}
http {
    default_type  application/octet-stream;
    access_log  logs/access.log;
    lua_package_path 'demo01/?.lua;;';
    server {
        listen       10000;
        server_name  localhost;
        default_type text/html;
        location = /favicon.ico {
            log_not_found off;
            access_log off;
        }

        location /test {
            content_by_lua_file demo01/test.lua;
        }
    }
}

  • test.lua
local function main()
    ngx.say("welcome to openresty world!")
end
main()

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

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

    <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>

配置Nginx服务

  • Edit Configurations
    在这里插入图片描述
  • 添加nginx server
    在这里插入图片描述
    -配置Nginx
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述

启动服务

构建

点击dist即可构建
在这里插入图片描述

启动nginx

选择配置的nginx服务并启动
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值