搭建OpenResty

参考:腾讯云手动实验https://cloud.tencent.com/developer/labs/lab/10290

了解OpenResty®

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

OpenResty®通过汇聚各种设计精良的Nginx模块(主要有OpenResty团队自主开发),从而将Nginx有效地变成一个强大的通用Web应用平台。主要Web开发人员和系统工程师可以使用Lua脚本语言调动Nginx支持的各种C以及Lua模块,快速构造出足以胜任10K及1000K以上单机并发连接的高性能Web应用系统。

OpenResty®的目标是让你的Web服务直接跑在Nginx服务内部,充分利用Nginx的非阻塞I/O模型,不仅仅对HTTP客户端请求,甚至于对远程后端诸如MySQL、PostgreSQL、Memcached以及Redis等都进行一致的高性能响应。

更新系统中的所有软件级工具

[root@localhost ~]# yum -y update

安装OpenResty®

添加官方repo源

[root@localhost ~]# yum install yum-utils
[root@localhost ~]# yum-config-manager --add-repo https://openresty.org/package/centos/openresty.repo

安装openresty

[root@localhost ~]# yum -y install openresty

启动服务

[root@localhost ~]# systemctl start openresty
[root@localhost ~]# systemctl enable openresty
[root@localhost ~]# ln -s /usr/local/openresty/nginx/sbin/* /usr/local/sbin/

访问http://1.1.1.5
在这里插入图片描述

配置OpenResty®

[root@localhost ~]# vim /usr/local/openresty/nginx/conf/nginx.conf
# 尝试修改端口号为8080
   server {
       listen       8080;

检查配置文件语法

[root@localhost ~]# nginx -t
nginx: the configuration file /usr/local/openresty/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/openresty/nginx/conf/nginx.conf test is successful

重启服务

[root@localhost ~]# systemctl restart openresty

访问http://1.1.1.5:8080
在这里插入图片描述

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值