[nginx]编译安装openresty
前言
OpenResty是一个基于Nginx和Lua的高性能Web平台,其内部集成了大量精良的Lua库、第三方模块以及大多数的依赖项。用于方便地搭建能够处理超高并发、扩展性极高的动态 Web 应用、Web 服务和动态网关。
版本信息
| 系统和应用 | 版本 |
|---|---|
| Debian | 11-amd64位 |
| OpenResty | 1.21.4.1 |
步骤
- 下载源码包并解压
wget https://openresty.org/download/openresty-1.21.4.1.tar.gz
tar xf openresty-1.21.4.1.tar.gz
- 编译
# apt安装依赖
apt install -y libpcre3-dev openssl libssl-dev libxml2-dev libgd-dev libxml2 libgeoip-dev libxslt-dev
cd openresty-1.21.4.1
# 以下预编译参数和Nginx的编译参数基本一致
./configure --prefix=/home/apps/openresty \
--with-threads \
--with-file-aio \
--with-http_ssl_module \
--with-http_v2_module \
--with-http_realip_module \
--with-http_addition_module \
--with-http_xslt_module=dynamic \
--with-http_image_filter_module=dynamic \
--with-http_geoip_module=dynamic \
--with-http_sub_module \
--with-http_dav_module \
--with-http_flv_module \
--with-http_mp4_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_auth_request_module \
--with-http_random_index_module \
--with-http_secure_link_module \
--with-http_degradation_module \
--with-http_slice_module \
--with-http_stub_status_module \
--with-stream_ssl_module \
--with-stream_realip_module \
--with-stream_geoip_module=dynamic \
--with-stream_ssl_preread_module \
--with-compat \
--with-pcre-jit
gmake
gmake install
- 启动OpenResty
/home/aps/openresty/bin/openresty
- 浏览器访问80端口测试
- (可选)验证无误后,将openresty的bin目录添加到系统环境变量PATH中
helloworld
- 编辑
/home/apps/openresty/nginx/conf/nginx.conf, 找到监听80端口的server,增加以下路由
location = /test {
default_type 'text/plain';
content_by_lua_block {
ngx.say('Hello World')
}
}
- 热加载生效
openresty -s reload
- 测试
curl http://127.0.0.1/test
ngx.say将数据作为响应体输出,返回给客户端,并在末尾加上一个回车符。
content_by_lua_block的主要作用是在HTTP的内容处理阶段生成数据
参考
[nginx]编译安装openresty的更多相关文章
- Nginx编译安装lua-nginx-module
lua-nginx-module 模块可以将Lua的强大功能嵌入NGINX服务器. 下载Nginx源码 如果已安装Nginx,需要查看当前安装版本的编译参数: $ /usr/local/nginx/s ...
- nginx编译安装支持lua脚本
一.准备编译环境 1.操作系统:CentOS7.6 2.安装编译所需安装包 yum install gcc pcre pcre-devel zlib zlib-devel openssl openss ...
- nginx编译安装
Nginx编译安装 1.nginx官网:http://wiki.nginx.org/Install下载:http://nginx.org/en/download.html 2.编译安装# wget h ...
- LNMP平台搭建之一:nginx编译安装
参考博客:https://www.cnblogs.com/zhang-shijie/p/5294162.html jack.zhang 一.环境说明 系统环境:centos6.5 [root@lo ...
- Nginx编译安装:
第三方模块 在nginx.org -------- wiki 找 --add-module= 添加 Nginx编译安装: 安装开发环境 ]# yum groupinstall " ...
- [nginx]编译安装及安全优化
nginx配置-最后整理版 nginx_upstream_check_module nginx-module-vts nginx打补丁 nginx编译安装 - 下载 cd /usr/local/src ...
- Linux下nginx编译安装教程和编译参数详解
这篇文章主要介绍了Linux下nginx编译安装教程和编译参数详解,需要的朋友可以参考下 一.必要软件准备1.安装pcre 为了支持rewrite功能,我们需要安装pcre 复制代码代码如下: # y ...
- 20190418 CentOS7实用技能综合:系统安装 + WinScp客户端连接 + 防火墙端口号iptables + Nginx编译安装 + MySQL编译安装 + Redis编译安装 + MongoDB编译安装 + ActiveMQ/RocketMQ/RabbitMQ编译安装 + ...各类常用生产环境软件的编译安装
系统安装 + WinScp客户端连接 + 防火墙端口号iptables + Nginx编译安装 + MySQL编译安装 + Redis编译安装 + MongoDB编译安装 + ActiveMQ/Roc ...
- Nginx编译安装第三方模块http_substitutions_filter_module2222
Nginx编译安装第三方模块http_substitutions_filter_module Rming -- 阅读 安装 Http 编译 module filter nginx 模块 >> ...
- Nginx编译安装第三方模块http_substitutions_filter_module
Nginx编译安装第三方模块http_substitutions_filter_module 分类:服务器技术 作者:rming 时间:-- . >>ngx_http_substitu ...
随机推荐
- sh: vue-cli-service: command not found
mac环境下运行vue项目报错sh: vue-cli-service: command not found 解决方法:cd到项目目录下,执行命令sudo rm -rf node_modules pac ...
- 2022-07-08:以下go语言代码输出什么?A:3;B:+Inf;C:true;D:编译错误。 package main import “fmt“ func main() { var
2022-07-08:以下go语言代码输出什么?A:3:B:+Inf:C:true:D:编译错误. package main import "fmt" func main() { ...
- 2020-12-01:java中,什么是安全点和安全区域?
福哥答案2020-12-04: 安全点用户线程暂停,GC 线程要开始工作,但是要确保用户线程暂停的这行字节码指令是不会导致引用关系的变化.所以 JVM 会在字节码指令中,选一些指令,作为"安 ...
- Play to Earn Games
什么是P2E游戏 P2E 游戏(Play to Earn Games)指的是在区块链游戏中,玩家可以通过完成任务.收获资源.挖矿或游戏中的其他活动以获得成就来赚取游戏内的资产(NFT)或代币(Toke ...
- django @login_required
Django在做后台系统过程中,我们通常都会为view函数添加 @login_required 装饰器,这个装饰器的主要作用就是在用户访问这个方法时,检查用户是否已经成功登陆,如果没有则重定向到登陆页 ...
- AcWing900.整数划分(python)
题目详情 知识点 计数类DP 分析题目,k个数是默认排好序的,也就是说,对于划分我们的考虑是无序的:例如 4 = 1+1+2 4 = 1+2+1 4 = 2+1+1 以上三种方式是没有区别的,所以在求 ...
- chrome 应用程序无法启动,因为应用程序的并行配置不正确
win10系统谷歌浏览器无法启动,系统报错,如下图: 解决方案: 步骤1:进入chrome的安装路径C:\Program Files (x86)\Google\Chrome\... ...(找到自己的 ...
- MySQL全面瓦解30:备份与恢复
合辑地址:MySQL全面瓦解 1 为什么需要数据库备份 灾难恢复:当发生数据灾难的时候,需要对损坏的数据进行恢复和还原 需求的变更或者回滚:当需求发生变更,或者需要回滚到之前的版本时,数据库备份也显得 ...
- 入门 Python GUI 开发的第一个坑
由于微信不允许外部链接,你需要点击文章尾部左下角的 "阅读原文",才能访问文中链接. 使用 Anaconda 3(conda 4.5.11)的 tkinter python 包(c ...
- 慢 SQL 优化之索引的作用是什么?
前言 本文针对 MySQL 数据库的 InnoDB 存储引擎,介绍其中索引的实现以及索引在慢 SQL 优化中的作用. 本文主要讨论不同场景下索引生效与失效的原因. 慢SQL与索引的关系 慢SQL优化原 ...