OpenResty 是一个基于 Nginx 与 Lua 的高性能 Web 平台,其内部集成了大量精良的 Lua 库、第三方模块以及大多数的依赖项。用于方便地搭建能够处理超高并发、扩展性极高的动态 Web 应用、Web 服务和动态网关。

OpenResty 官方 APT 包仓库提供了 deb 包 (适用于 Ubuntu 和 Debian),可以很方便的安装,一起来看下具体的安装步骤吧。

Debian 更新系统

$ apt update
# 这一步选做
$ apt upgrade

添加 openresty 仓库

可以在 Debian 系统中添加 openresty 仓库,这样就可以方便的安装或更新我们的软件包(通过 apt update 命令)。

运行下面的命令就可以添加我们的仓库(每个系统只需要运行一次):

步骤一:安装导入 GPG 公钥时所需的几个依赖包(整个安装过程完成后可以随时删除它们):

sudo apt -y install --no-install-recommends wget gnupg ca-certificates

步骤二:导入我们的 GPG 密钥:

wget -O - https://openresty.org/package/pubkey.gpg | sudo apt-key add -

步骤三:添加我们官方 APT 仓库。

对于 x86_64 或 amd64 系统,可以使用下面的命令:

codename=`grep -Po 'VERSION="[0-9]+ \(\K[^)]+' /etc/os-release`

echo $codename

echo "deb http://openresty.org/package/debian $codename openresty" \
| sudo tee /etc/apt/sources.list.d/openresty.list

这历史查找当前 debian 系统的版本(即 $codename 变量),更加系统版本再配置。

root@VM-4-14-debian:/opt# codename=`grep -Po 'VERSION="[0-9]+ \(\K[^)]+' /etc/os-release`
root@VM-4-14-debian:/opt# echo $codename
root@VM-4-14-debian:/opt# bullseye
root@VM-4-14-debian:/opt# echo "deb http://openresty.org/package/debian bullseye openresty" | sudo tee /etc/apt/sources.list.d/openresty.list
deb http://openresty.org/package/debian bullseye openresty

而对于 arm64 或 aarch64 系统,则可以使用下面的命令:

codename=`grep -Po 'VERSION="[0-9]+ \(\K[^)]+' /etc/os-release`

echo "deb http://openresty.org/package/arm64/debian $codename openresty" \
| sudo tee /etc/apt/sources.list.d/openresty.list

更新APT索引并安装

步骤四:更新 APT 索引:

sudo apt update

然后就可以像下面这样安装软件包,比如 openresty:

sudo apt -y install openresty

这个包同时也推荐安装 openresty-opm 和 openresty-restydoc 包,所以后面两个包会缺省安装上。

如果你不想自动关联安装,可以用下面方法关闭自动关联安装:

sudo apt -y install --no-install-recommends openresty

openresty-opm 是 OpenResty 的包管理工具(OpenResty package manager)。

查看安装的版本:

安装目录: /usr/local/openresty

$ nginx -v
nginx version: openresty/1.21.4.1 $ /usr/local/openresty/nginx/sbin/nginx -v
nginx version: openresty/1.21.4.1

使用 systemctl 可以管理openresty服务:

systemctl enable openresty
systemctl status openresty
systemctl start openresty
systemctl stop openresty
systemctl restart openresty

验证效果,通过 curl 命令请求 localhost :

root@VM-4-14-debian:~# curl -I localhost
HTTP/1.1 200 OK
Server: openresty/1.21.4.1
Date: Sun, 09 Oct 2022 14:04:10 GMT
Content-Type: text/html
Content-Length: 1097
Last-Modified: Tue, 17 May 2022 03:51:45 GMT
Connection: keep-alive
ETag: "62831bd1-449"
Accept-Ranges: bytes

也可以打开浏览器 ,访问服务器ip,查看页面验证。

参考链接

https://wang123.net/a/linux-debian-install-openresty

https://openresty.org/cn/linux-packages.html

在Debian11上安装Openresty服务(Nginx+Lua)的更多相关文章

  1. 在Ubuntu上安装openResty #1

    在Ubuntu上安装openResty #1 OpenResty® 是一个基于 Nginx 与 Lua 的高性能 Web 平台,其内部集成了大量精良的 Lua 库.第三方模块以及大多数的依赖项.用于方 ...

  2. CentOS 7 下安装 LEMP 服务(nginx、MariaDB/MySQL 和 php)

    原文 CentOS 7 下安装 LEMP 服务(nginx.MariaDB/MySQL 和 php) LEMP 组合包是一款日益流行的网站服务组合软件包,在许多生产环境中的核心网站服务上起着强有力的作 ...

  3. 在 CentOS 上安装 vsftp 服务

    在 CentOS 上安装 vsftp 服务 1.查看当前 CentOS 服务器是否已安装了 vsftpd 服务: rpm -q vsftpd 如果打印如下类似的信息则表明已安装 vsftpd 服务: ...

  4. 在Ubuntu 14.04 上安装 FTP 服务

    1. sudo apt-get update 2. sudo apt-get install vsftpd 3. adduser sammy Assign a password when prompt ...

  5. 【原创】大叔经验分享(77)openresty(nginx+lua)发http请求

    openresty(nginx+lua)发http请求 利用location+proxy_pass间接实现 location ^~ /test/http { internal; proxy_pass ...

  6. 在Linux上安装Oracle服务的操作步骤

    如题,将我在云服务器上安装Oracle服务的惨痛经历分享出来,期间查找的资料踩过的坑无数,希望对大家能有帮助 闲话少叙,直接开始 首先,由于服务器比较差,需要先设置swap 查看是否设置swap虚拟内 ...

  7. vps上安装CobaltStrike服务端

    今天我在我的vps上安装CobaltStrike服务端,真的是踩坑无数,所以写这篇博客记录一下,防止后人再踩坑 安装Oracle JDK8 官方不建议使用OpenJdk,建议使用Oracle JDK的 ...

  8. flink---实时项目--day01--1. openrestry的安装 2. 使用nginx+lua将日志数据写入指定文件中 3. 使用flume将本地磁盘中的日志数据采集到的kafka中去

    1. openrestry的安装 OpenResty = Nginx + Lua,是⼀一个增强的Nginx,可以编写lua脚本实现⾮非常灵活的逻辑 (1)安装开发库依赖 yum install -y ...

  9. CentOS 下安装 LEMP 服务(nginx、MariaDB/MySQL 和 php)

    转载自:https://linux.cn/article-4314-1.html 编译自:http://xmodulo.com/install-lemp-stack-centos.html 作者: D ...

  10. [转载]CentOS 下安装LEMP服务(Nginx、MariaDB/MySQL和PHP)

    LEMP 组合包是一款日益流行的网站服务组合软件包,在许多生产环境中的核心网站服务上起着强有力的作用.正如其名称所暗示的, LEMP 包是由 Linux.nginx.MariaDB/MySQL 和 P ...

随机推荐

  1. HttpServletRequest获取参数和文件

    从HttpServletRequest中获取上传文件及参数的方法 try { //下面这句必须加,不然报错 MultipartResolver resolver = new CommonsMultip ...

  2. 微服务框架——SpringBoot

    SpringBoot 1.创建Boot项目的两种方式 1.1通过spring网站创建 进入Spring Initializr 选择填写对应配置,打包 将zip格式的压缩包解压,并导入该项目 1.2 通 ...

  3. 【白话模电1】PN结与二极管

    距离上一次写半导体,已经过了很久了,上次分享了本征半导体的基本概念: https://zhuanlan.zhihu.com/p/109483580 今天给大家聊聊半导体工业中的基础:PN结与二极管 1 ...

  4. Miller-Rabin 与 Pollard-Rho 算法学习笔记

    前言 Miller-Rabin 算法用于判断一个数 \(p\) 是否是质数,若选定 \(w\) 个数进行判断,那么正确率约是 \(1-\frac{1}{4^w}\) ,时间复杂度为 \(O(\log ...

  5. (14)go-micro微服务服务层Handle开发

    目录 一 Handle层开发功能说明 需要完成的服务开发功能: 从哪找需要开发的功能 二 代码编写 三 最后 一 Handle层开发功能说明 需要完成的服务开发功能: 登录 注册 查询用户信息 修改信 ...

  6. C Primer Plus (6.16) 編程練習

    /*C Primer Plus (6.15) 6*/ 1 #include<stdio.h> 2 int main() 3 { 4 int i,j; 5 for(int i=0;i< ...

  7. 深入Typescript--01-使用roolup编译Typescript

    Typescript是什么? TypeScript是Javascript的超集,遵循最新的ES5/ES6规范.Typescript扩展了Javascript语法. 为什么要用Typescript? 1 ...

  8. 主线程-创建Thread类的子类

    主线程 Java使用java.lang.Thread类代表线程,所有的线程对象都必须是Thread类或其子类的实例.每个线程的作用是完成一定的任务,实际上就是执行一段程序流即一段顺序执行的代码.Jav ...

  9. 【分析笔记】Linux gpio_wdt.c 看门狗设备驱动源码分析

    基本原理 该看门狗的设备驱动实现原理很简单,比较主要的有两点: 一.定时器喂狗 通过定时器根据配置文件配置的喂狗方式(如脉冲切换.电平切换),对指定的 gpio 进行脉冲切换或电平切换实现喂狗. 脉冲 ...

  10. 【随笔记】XR872 Codec 驱动移植和应用程序实例(附芯片调试方法)

    XR872 的 SDK 是我目前接触过那么多款 MCU 的 SDK 中,唯一一个将框架和 RTOS 结合的非常完美的 SDK .无论是代码风格还是框架的设计,看起来都很赏心悦目,而且是源码开源.希望能 ...