编译安装openresty

摘要:
所选版本Openresty的版本号相对简单。形式为:Openresty 1.2.3。例如,Openresty 1.17.8.2表示它是基于Nginx1.17.8开发的第二个版本。选择的标准是根据自己的需要下载并安装与nginx版本对应的预编译包(可以跳过)。这里,以Centos为例,简单介绍一下。根据官方要求,RedHat类系统支持的Openresty版本为:x.x.6.xx.x.7.xx.8。x(x)

选择版本

Openresty的版本号比较简单,形式为:Openresty 1.2.3.x 例如Openresty 1.17.8.2表示是基于Nginx 1.17.8开发的第二个版本
那么选择的标准就是根据自己的需要,对应nginx的版本来下载

预编译包安装(可跳过)

这里以centos为例,简单带过一下,根据官方的要求,Red Hat类的系统支持的Openresty版本为:
x.x.6.x
x.x.7.x
x.x.8.x

yum包安装的话很简单

[root@localhost ~]# wget https://openresty.org/package/centos/openresty.repo      #下载yum配置文件
[root@localhost ~]# mv openresty.repo /etc/yum.repos.d/      #移动文件至yum配置目录下
[root@localhost ~]# yum check-update      #检查更新,生效yum配置文件
[root@localhost ~]# yum install -y openresty      #安装
[root@localhost ~]# yum install -y openresty openresty-resty      #安装Openresty和命令行工具 resty
[root@localhost ~]# systemctl start openresty.service       #开启Openresty服务

事实上这个时候我们就可以初见Openresty和Nginx那“不清不楚”的关系-
编译安装openresty第1张
使用浏览器验证一下,服务是否正常
编译安装openresty第2张

源码包编译安装

其实选择源码包编译安装和yum安装并没有多大区别(对开发实验而言,功能上并没有多大区别),只不过源码包安装可以"个性化"定制:指定安装路径、配置参数,增删模块等
废话不多说,开整
指定安装路径为/web目录(根据自己的需要)
启动HTTP2和真实IP地址转发
编译使用OpenSSL 1.1.1g

[root@localhost ~]# mkdir /web      #创建/web目录
[root@localhost ~]# cd /usr/local/src/      #切换到源码包安装目录
[root@localhost src]# wget https://openresty.org/download/openresty-1.15.8.3.tar.gz      #下载源码包
[root@localhost src]# wget https://www.openssl.org/source/openssl-1.1.1g.tar.gz
[root@localhost src]# tar -zvxf openresty-1.15.8.3.tar.gz       #解压openresty
[root@localhost src]# tar -zvxf openssl-1.1.1g.tar.gz           #解压openssl
[root@localhost src]# cd openresty-1.15.8.3/      #进入安装目录
[root@localhost openresty-1.15.8.3]# ./configure --prefix=/web/openresty --with-http_v2_module --with-http_realip_module --with-openssl=/usr/local/src/openssl-1.1.1g
[root@localhost openresty-1.15.8.3]# gmake 
[root@localhost openresty-1.15.8.3]# gmake install 

验证

[root@localhost ~]# /web/openresty/bin/openresty       #开启openresty服务
[root@localhost ~]# netstat -tunlp|grep 80             #监听80端口
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      70847/nginx: master 
[root@localhost ~]# ps -aux |grep openresty            #查看openresty进程
root      70847  0.0  0.1  33024  1444 ?        Ss   09:10   0:00 nginx: master process /web/openresty/bin/openresty
root      70860  0.0  0.0 112824   976 pts/1    R+   09:10   0:00 grep --color=auto openresty

浏览器验证
编译安装openresty第3张

免责声明:文章转载自《编译安装openresty》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇提高 iOS App 通知功能启用率的三个策略【Android】超详细appnium android-sdk-windoes python 操作真手机或安卓虚拟机(使用安装包我放在最下面的云盘链接),内附测试代码,下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

as3 屏幕截图教程(附源码及代码说明)

////////////////////////////////// as源码 ////////////////////////////////// import JPGEncoder; //设置要截屏的范围 var jpg:BitmapData=new BitmapData(stage.stageWidth,stage.stageHeight);//...

句柄与句柄表(数据结构,源码分析)

0x01  句柄,句柄表概念     任意进程,只要每打开一个对象,就会获得一个句柄,这个句柄用来标志对某个对象的一次打开,通过句柄,可以直接找到对应的内核对象。句柄本身是进程的句柄表中的一个结构体,用来描述一次打开操作。句柄值则可以简单看做句柄表中的索引,并不影响理解。HANDLE的值可以简单的看做一个整形索引值。     每个进程都有一个句柄表,用来记...

配置nginx

上一篇配置了uwsgi:https://www.cnblogs.com/kkkboshow/p/11172409.html 1.安装nginx, centos直接    yum install nginx 2.配置nginx   # 进入配置目录: cd /etc/nginx/conf.d   # 创建自己的配置文件: touch dev.conf 3.n...

nginx使用多端口监听多个服务

###### nginx监听多个端口并转发给不同的服务 ### 第一个监听: upstream odoo { server localhost:8067; } upstream odoochat{ server localhost:8072; } server { listen 8070default_server; listen [::]:80...

C# winform 中的Form 源码

1 [DefaultEvent("Load"), InitializationEvent("Load"), ComVisible(true), ClassInterface(ClassInterfaceType.AutoDispatch), ToolboxItemFilter("System.Windows.Forms.Control.TopLevel"...

在CentOS下源码安装 Xen并搭建Windows虚拟机

前言首先要感谢xing的帮助,在他的指导之下才完成环境的搭建,本文档的部分内容来自他的文档。另外,还要感谢——互联网。   1.       环境介绍Linux: CentOS 6.3 Xen: Xen 4.1.3 Windows: XP 或 2003 2.       安装CentOS从官网下载CentOS 6.3镜像: http://www.cent...