安装环境:CentOS 7.0

1、 安装编译工具、依赖库

yum -y install readline-devel pcre-devel openssl-devel gcc

2、 下载openresty-1.13.6.1.tar.gz 源码包,并解压;下载ngx_cache_purge模块,该模块用于清理nginx缓存;下载nginx_upstream_check_module模块,该模块用于ustream健康检查

wget https://openresty.org/download/openresty-1.13.6.1.tar.gz
tar -zxvf openresty-1.13.6.1.tar.gz
cd openresty-1.13.6.1/bundle
wget http://labs.frickle.com/files/ngx_cache_purge-2.3.tar.gz
tar -zxvf ngx_cache_purge-2.3.tar.gz
wget https://github.com/yaoweibin/nginx_upstream_check_module/archive/v0.3.0.tar.gz
tar -zxvf v0.3.0.tar.gz

3、配置需安装的模块

./configure --prefix=/usr/local/openresty --with-luajit --with-http_ssl_module --user=root --group=root --with-http_realip_module --add-module=./bundle/ngx_cache_purge-2.3/ --add-module=./bundle/nginx_upstream_check_module-0.3./

4、编译安装

make -j2 && make install

5、编写nginx配置文件

cd /usr/local/openresty/nginx/conf/
vim nginx.conf

添加这一段

   location /hello {
default_type text/html;
content_by_lua '
ngx.say("<p>hello, world</p>")
';
}

然后测一下

[root@VM_0_10_centos conf]# curl 127.0.0.1/hello
<p>hello, world</p>

6、还有另一种方式,使用lua文件

继续编写nginx配置文件

     

location /hello {
  content_by_lua_file /usr/local/openresty/nginx/conf/lua/hello.lua;
}

编写hello.lua文件

ngx.say('<p>hello world!</p>')

检查语法

./nginx -t -c /usr/local/openresty/nginx/conf/nginx.conf

重启nginx

./nginx -s reload -c /usr/local/openresty/nginx/conf/nginx.conf

测试一下

[root@VM_0_10_centos conf]# curl 127.0.0.1/hello                               
<p>hello world!</p>

成功输出了hello world!

OpenResty安装与hello world的更多相关文章

  1. mac下openresty安装

    //openresty安装 http://openresty.org/ brew updatebrew install pcre openssl ./configure --prefix=/usr/l ...

  2. OpenResty 安装 drizzle-nginx-module

    1.下载drizzle模块 wget http://openresty.org/download/drizzle7-2011.07.21.tar.gz 2.安装drizzle模块 tar zxvf d ...

  3. Openresty安装及使用配置(OPENRESTY+NGINX)

    Openresty 简介 Openresty是一个基于NGINX和Lua的高性能Web平台,内部有大量的Lua库和第三方模块,能够很方便的搭建处理高并发,扩展性高的Web平台和动态网关,充分利用 Ng ...

  4. Openresty 安装第三方插件

    Openresty 安装第三方插件 程序媛没有夜生活 2016.08.02 15:33* 字数 167 阅读 1283评论 0喜欢 2 在安装之前,我们先来看一下我们现有的模块. 1.将需要安装的插件 ...

  5. OpenResty 安装配置

    0. 说明 1. Windows 下安装 下载软件包 openresty-1.13.6.1-win32.zip ,解压即可食用. [开启] 直接运行 nginx.exe 在 Windows 的命令窗口 ...

  6. openresty安装文档

    一.OpenResty简介    OpenResty是一个基于 Nginx与 Lua的高性能 Web平台,其内部集成了大量精良的 Lua 库.第三方模块以及大多数的依赖项.用于方便地搭建能够处理超高并 ...

  7. CentOS7上OpenResty安装

    1,OpenResty安装 通过repl源安装: sudo yum-config-manager --add-repo https://openresty.org/yum/cn/centos/Open ...

  8. openresty安装笔记

    目录 安装步骤: openresty安装在ubuntu下的安装 参考 安装OpenResty(Nginx+Lua)开发环境 安装步骤: # 创建目录/usr/servers,以后我们把所有软件安装在此 ...

  9. OpenResty 安装及使用(第一篇安装)

    OpenResty搭建 1.openResty介绍 OpenResty (也称为 ngx_openresty)是一个全功能的 Web 应用服务器.它打包了标准的 Nginx 核心,很多的常用的第三方模 ...

  10. Openresty 安装教程

    Openresty的简单安装方法,如需高级编译安装,请参照安装选项 1.安装配置好Yum源,不赘述此步骤 2.安装必要组件 yum install pcre-devel openssl-devel g ...

随机推荐

  1. 记秋招第一个offer:去哪儿

    9月17日 网申去哪儿,没有内推,因为网申了就不能内推了.难受,内推可以免简历筛选的,这下好了,可能简历直接挂了.我怎么犯了这么低级的错误?还没去搞清楚能不能内推就先傻乎乎地网申了. 9月28日 晚上 ...

  2. BZOJ4355: Play with sequence(吉司机线段树)

    题意 题目链接 Sol 传说中的吉司机线段树??感觉和BZOJ冒险那题差不多,就是强行剪枝... 这题最坑的地方在于对于操作1,$C >= 0$, 操作2中需要对0取max,$a[i] > ...

  3. 「转」sqlalchemy 0.9.8 多对多级联删除

    转自知乎 http://www.zhihu.com/question/21050551 有 A,B,C,AB,AC五张表 class A(base): __tablename__ = "a& ...

  4. 上传高德地图-express框架

    1.首先要注册高德地图,完后成为开发者 2.控制台里获取自己的key值 3.在要显示地图的页面添加如下的代码 <script type="text/javascript" s ...

  5. 如何在Java代码中使用SAP云平台CloudFoundry环境的环境变量

    本文使用的例子源代码在我的github上. 在我的公众号文章在SAP云平台的CloudFoundry环境下消费ABAP On-Premise OData服务介绍了如何通过Cloud Connector ...

  6. python基础一 day16 匿名函数

    def add(x,y): return x+y add = lambda x,y:x+yprint(add(1,2)) dic={'k1':10,'k2':100,'k3':30}def func( ...

  7. Redis学习记录(二)

    1.Key命令 设置key的过期时间. expire key second:设置key的过期时间 ttl key:查看key的有效期(如果显示正数说明该key正在倒计时,如果是-1说明该key永久保存 ...

  8. C# 界面跳转-登陆之后跳转至主窗口

    在登陆按钮验证成功之后可以将会话结果改为OK //验证通过之后将对话结果设置为OK(之后会载入主界面) this.DialogResult = DialogResult.OK; this.Dispos ...

  9. 手写promise

    写在前面: 在目前的前端分开中,我们对于异步方法的使用越来越频繁,那么如果处理异步方法的返回结果,如果优雅的进行异步处理对于一个合格的前端开发者而言就显得尤为重要,其中在面试中被问道最多的就是对Pro ...

  10. python 基础 for else

    for one in many_list: if "k" in one: print "在里面" break else: print "没有在里面&q ...