如何进行openresty安装部署脚本

2023-04-14 10:52:00 部署 安装 脚本

如何进行openresty安装部署脚本

OpenResty® 是一个基于 Nginx 与 Lua 的高性能 Web 平台,其内部集成了大量精良的 Lua 库、第三方模块以及大多数的依赖项。目标是将 Nginx 最佳的特性,Lua 的强大功能以及多平台多语言的特性最大限度的发挥出来,从而打造一个能够快速搭建、方便维护的企业级高性能 Web 应用框架。

OpenResty 的目标是通过尽可能简单的方式实现一个功能丰富的 Web平台,从而使得开发者能够专注于业务逻辑而不是底层实现。OpenResty 可以帮助开发者高效的构建动态 Web 应用,例如:

- 使用 Lua 脚本构建复杂的应用,并通过 Nginx 的高性能来提供服务。

- 通过 Lua 脚本嵌入到 Nginx 中实现应用级别的功能,比如限流、访问控制、协议转换等。

- 通过 Lua 脚本实现复杂的应用逻辑,比如分布式会话、分布式锁、分布式数据库访问等。

OpenResty 的主要特性包括:

- 简单易用:OpenResty 的配置和 Nginx 的配置类似,并且提供了大量的 Lua API,可以轻松的实现复杂的应用逻辑。

- 高性能:OpenResty 可以充分利用 Nginx 的高性能特性,并且通过 Lua 的高效编程模型,可以实现更高的性能。

- 多平台支持:OpenResty 可以运行在 Linux、MacOS、FreeBSD、Windows 等多种平台上。

- 多语言支持:OpenResty 支持 Lua、Java、Python、Ruby 等多种语言,可以轻松的开发多语言应用。

- 开源免费:OpenResty 是开源的项目,并且提供了完整的文档和示例代码,可以免费使用。

OpenResty 安装部署脚本

1、下载安装脚本

wget https://openresty.org/download/openresty-1.13.6.2.tar.gz

2、解压安装包

tar -zxvf openresty-1.13.6.2.tar.gz

3、进入安装目录

cd openresty-1.13.6.2

4、执行安装脚本

./configure --prefix=/usr/local/openresty/ \

--with-http_ssl_module \

--with-http_stub_status_module \

--with-http_realip_module \

--with-http_addition_module \

--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_random_index_module \

--with-http_secure_link_module \

--with-http_degradation_module \

--with-http_slice_module \

--with-http_stub_status_module \

--http-client-body-temp-path=/usr/local/openresty/client-body-temp \

--http-proxy-temp-path=/usr/local/openresty/proxy-temp \

--http-fastcgi-temp-path=/usr/local/openresty/fastcgi-temp \

--http-uwsgi-temp-path=/usr/local/openresty/uwsgi-temp \

--http-scgi-temp-path=/usr/local/openresty/scgi-temp \

--with-luajit \

--with-http_iconv_module

5、编译安装

make && make install

6、启动openresty

/usr/local/openresty/nginx/sbin/nginx

7、设置开机启动

echo "/usr/local/openresty/nginx/sbin/nginx" >> /etc/rc.local

8、检查运行状态

ps -ef | grep nginx

9、访问测试

curl localhost

如果出现以下内容,则表示安装成功

Welcome to nginx!

Welcome to nginx!

If you see this page, the nginx web server is successfully installed and

working. Further configuration is required.

For online documentation and support please refer to

nginx.org.

Commercial support is available at

nginx.com.

Thank you for using nginx.

相关文章