OpenResty 下载

Posted 锦衣admin

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了OpenResty 下载相关的知识,希望对你有一定的参考价值。

OpenResty

openresty 在nginx的基础上,结合lua脚本实现高并发的web平台。作者章亦春

WAF nginx+lua+redis 实现应用型防火墙 动态把IP加入黑名单

官方网址:http://openresty.org/cn/

编译安装步骤:

解压编译并安装
	# cd /root/soft
	# tar xvf openresty-1.15.8.1.tar.gz
	# cd openresty-1.15.8.1
	# ./configure --prefix=/usr/local/openresty
	# make && make install

启动openresty:
#l /usr/local/openresty/bin/openresty			=>	其实就是/usr/local/openresty/nginx/sbin/nginx 的软连接
	[root@sever_01 bin]# ll openresty
		lrwxrwxrwx 1 root root 37 Jun 30 04:49 openresty -> /usr/local/openresty/nginx/sbin/nginx


查看启动效果哦:
[root@sever_01 openresty]# ps -ef |grep nginx
	root      35702      1  0 04:50 ?        00:00:00 nginx: master process /usr/local/openresty/bin/openresty
	nobody    35703  35702  0 04:50 ?        00:00:00 nginx: worker process


查看默认编译参数及其模块
#l /usr/local/openresty/bin/openresty -V		=>	会发现默认帮我们加载了许多配置
	[root@sever_01 openresty]# /usr/local/openresty/bin/openresty -V
	nginx version: openresty/1.15.8.1
	built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC)
	built with OpenSSL 1.0.2k-fips  26 Jan 2017
	TLS SNI support enabled
	configure arguments: --prefix=/usr/local/openresty/nginx --with-cc-opt=-O2 --add-module=../ngx_devel_kit-0.3.1rc1 --add-module=../echo-nginx-module-0.61 --add-module=../xss-nginx-module-0.06 --add-module=../ngx_coolkit-0.2 --add-module=../set-misc-nginx-module-0.32 --add-module=../form-input-nginx-module-0.12 --add-module=../encrypted-session-nginx-module-0.08 --add-module=../srcache-nginx-module-0.31 --add-module=../ngx_lua-0.10.15 --add-module=../ngx_lua_upstream-0.07 --add-module=../headers-more-nginx-module-0.33 --add-module=../array-var-nginx-module-0.05 --add-module=../memc-nginx-module-0.19 --add-module=../redis2-nginx-module-0.15 --add-module=../redis-nginx-module-0.3.7 --add-module=../rds-json-nginx-module-0.15 --add-module=../rds-csv-nginx-module-0.09 --add-module=../ngx_stream_lua-0.0.7 --with-ld-opt=-Wl,-rpath,/usr/local/openresty/luajit/lib --with-stream --with-stream_ssl_module --with-stream_ssl_preread_module --with-http_ssl_module

使用lua模块语法

第一步:修改配置文件

# vim /usr/local/openresty/nginx/conf/nginx.conf		=>	增加两行配置
location / {
    root html;
    index index.html index.htm;
    
    default_type text/html;								=>	默认返回类型
    
    content_by_lua 'ngx.say("hello openresty")';		=>	调用lua模块的语法
}	



#l /usr/local/openresty/bin/openresty -s reload			=>	修改完重载
  • 访问页面就会
    在这里插入图片描述

以上是关于OpenResty 下载的主要内容,如果未能解决你的问题,请参考以下文章

OpenResty 下载

openresty的初步使用

源代码编译安装

Chaya大数据架构综合实践课程学习 ——— Openresty安装

openresty 安装指南

Openresty + nginx-upload-module支持文件上传