美文网首页技术杂谈
centos 安装OpenResty

centos 安装OpenResty

作者: kinglau | 来源:发表于2017-04-05 15:21 被阅读611次

一、安装准备

安装OpenResty之前,您必须将这些库 perl 5.6.1+, libreadline, libpcre, libssl安装在您的电脑之中。

安装perl支持

yum install perl* (yum安装perl相关支持)
yum install cpan (perl需要的程序库,需要cpan的支持)

安装其他

yum install readline-devel pcre-devel openssl-devel gcc

二、构建 OpenResty

下载

从下载页 Download下载最新的 OpenResty® 源码包,并且像下面的示例一样将其解压:
tar -xzvf openresty-VERSION.tar.gz

VERSION 的地方替换成您下载的源码包的版本号,比如说 1.11.2.2。

然后在进入 openresty-VERSION/ 目录, 然后输入以下命令配置:

./configure

默认, --prefix=/usr/local/openresty 程序会被安装到/usr/local/openresty目录。

您可以指定各种选项,比如

./configure --prefix=/opt/openresty \ 
    --with-luajit \ 
    --without-http_redis2_module \ 
    --with-http_iconv_module \ 
    --with-http_postgres_module

试着使用 ./configure --help 查看更多的选项。

配置文件(./configure script)运行出错可以到 build/nginx-VERSION/objs/autoconf.err 找到。 VERSION 必须与OpenResty版本号相对应, 比如 1.11.2.2。

make

您可以使用下面的命令来编译:
make

如果您的电脑支持多核 make 工作的特性, 您可以这样编译:
make -j2

make install

如果前面的步骤都没有问题的话,您可以使用下面的命令安装l OpenResty到您的系统之中:
make install

在 Linux,通常包括 sudo来执行root权限做的事情。

三、运行

[root@localhost openresty]# cd /usr/local/openresty/nginx
[root@localhost nginx]# sbin/nginx

四、确认是否运行成功

执行下面命令

[root@localhost nginx]# curl http://localhost

输出如下内容,说明已经成功运行

<!DOCTYPE html>
<html>
<head>
<title>Welcome to OpenResty!</title>
<style>
    body {
        width: 35em;
        margin: 0 auto;
        font-family: Tahoma, Verdana, Arial, sans-serif;
    }
</style>
</head>
<body>
<h1>Welcome to OpenResty!</h1>
<p>If you see this page, the OpenResty web platform is successfully installed and
working. Further configuration is required.</p>

<p>For online documentation and support please refer to
<a href="https://openresty.org/">openresty.org</a>.<br/>

<p><em>Thank you for flying OpenResty.</em></p>
</body>
</html>

或者在浏览器中输入http://localhost

相关文章

  • openresty

    1、openResty安装 centos 安装 2、openresty配置 nginx匹配规则 服务端获得客户端...

  • nginx openresty

    openResty安装 centos 添加yum仓库,安装 openresty配置 服务端获得客户端的真实ip ...

  • OpenResty源码安装

    本文是在CentOS7.4环境下安装OpenResty 下载 OpenResty下载地址[https://open...

  • apioak安装使用教程

    centos 7 安装apioak 安装 OpenResty 和其他必需的依赖项 安装MariaDB 安装aoio...

  • centos 安装openresty

    1. 安装依赖的软件包 /usr/bin/env: perl: No such file or directory...

  • centos 安装OpenResty

    一、安装准备 安装OpenResty之前,您必须将这些库 perl 5.6.1+, libreadline, li...

  • CentOS安装OpenResty

    源码包编译安装 下载 从下载页Download下载最新的 OpenResty®源码包,并且像下面的示例一样将其解压...

  • CentOS 安装openresty

    下载openresty 的repo库 移动repo库文件到yum的repo库中 更新 安装openresty 启动...

  • kong、konga源码安装笔记

    安装环境 依赖:centos 7.5kong:1.2.1lua: 2.0.5openresty: 1.13.6.2...

  • openresty起步

    openresty 安装openresty 1、源码安装 安装前准备: 源码下载地址:openresty 解压、安...

网友评论

    本文标题:centos 安装OpenResty

    本文链接:https://www.haomeiwen.com/subject/tmmaottx.html