OpenResty安装与hello world
安装环境: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的更多相关文章
- mac下openresty安装
//openresty安装 http://openresty.org/ brew updatebrew install pcre openssl ./configure --prefix=/usr/l ...
- OpenResty 安装 drizzle-nginx-module
1.下载drizzle模块 wget http://openresty.org/download/drizzle7-2011.07.21.tar.gz 2.安装drizzle模块 tar zxvf d ...
- Openresty安装及使用配置(OPENRESTY+NGINX)
Openresty 简介 Openresty是一个基于NGINX和Lua的高性能Web平台,内部有大量的Lua库和第三方模块,能够很方便的搭建处理高并发,扩展性高的Web平台和动态网关,充分利用 Ng ...
- Openresty 安装第三方插件
Openresty 安装第三方插件 程序媛没有夜生活 2016.08.02 15:33* 字数 167 阅读 1283评论 0喜欢 2 在安装之前,我们先来看一下我们现有的模块. 1.将需要安装的插件 ...
- OpenResty 安装配置
0. 说明 1. Windows 下安装 下载软件包 openresty-1.13.6.1-win32.zip ,解压即可食用. [开启] 直接运行 nginx.exe 在 Windows 的命令窗口 ...
- openresty安装文档
一.OpenResty简介 OpenResty是一个基于 Nginx与 Lua的高性能 Web平台,其内部集成了大量精良的 Lua 库.第三方模块以及大多数的依赖项.用于方便地搭建能够处理超高并 ...
- CentOS7上OpenResty安装
1,OpenResty安装 通过repl源安装: sudo yum-config-manager --add-repo https://openresty.org/yum/cn/centos/Open ...
- openresty安装笔记
目录 安装步骤: openresty安装在ubuntu下的安装 参考 安装OpenResty(Nginx+Lua)开发环境 安装步骤: # 创建目录/usr/servers,以后我们把所有软件安装在此 ...
- OpenResty 安装及使用(第一篇安装)
OpenResty搭建 1.openResty介绍 OpenResty (也称为 ngx_openresty)是一个全功能的 Web 应用服务器.它打包了标准的 Nginx 核心,很多的常用的第三方模 ...
- Openresty 安装教程
Openresty的简单安装方法,如需高级编译安装,请参照安装选项 1.安装配置好Yum源,不赘述此步骤 2.安装必要组件 yum install pcre-devel openssl-devel g ...
随机推荐
- JS实现2048
2048这个游戏是通过对二维数组的操作来实现的,其算法核心如下: (以一行左移为例) c从0开始,遍历当前行中的元素,到<CN-1(CN是一个常量,表示的是游戏格子的列数)结束,每次+1 找到当 ...
- es6-async
含义 ES2017 标准引入了 async 函数,使得异步操作变得更加方便. async 函数是什么?一句话,它就是 Generator 函数的语法糖. 前文有一个 Generator 函数,依次读取 ...
- 原生css3作响应式布局
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <m ...
- SpringBoot的异步调用介绍
参考博客: https://www.cnblogs.com/jebysun/p/9675345.html https://blog.csdn.net/weixin_38399962/article/d ...
- meterpreter > screenshot
meterpreter > screenshotScreenshot saved to: /opt/metasploit/msf3/wLafQYhx.jpegmeterpreter > / ...
- [Asp.Net] web api 部署注意事项
在将web api项目部署到IIS上的时候 要将应用程序池设置成.net framework 4.0版本
- 在 Visual Studio 或 SQLServer Management Studio 的代码编辑器中使用正则表达式匹配日期格式
使用正则查找时间格式文本 VS正则: (:z表示数字) ':z-:z-:z :z[\:]:z[\:]:z'
- java Vamei快速教程14 异常处理
作者:Vamei 出处:http://www.cnblogs.com/vamei 欢迎转载,也请保留这段声明.谢谢! 程序很难做到完美,不免有各种各样的异常.比如程序本身有bug,比如程序打印时打印机 ...
- codeforces 600D Area of Two Circles' Intersection
分相离,内含,想交三种情况讨论一下. 主要是精度和数据范围的问题,首先数据用long double,能用整型判断就不要用浮点型. 题目中所给的坐标,半径是整型的,出现卡浮点判断的情况还是比较少的. 最 ...
- 国外常用代理IP对比【仅供参考】
国外常用代理IP对比[仅供参考]http://www.it588.cn/vmware/2019-03-22/547.html