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

安装

[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://192.168.1.11

OpenResty

配置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://192.168.1.11:8080

成功~

评论




正在载入...
PoweredHexo
HostedAliyun
DNSAliyun
ThemeVolantis
UV
PV
BY-NC-SA 4.0