1、安装环境、版本说明:

操作系统: Centos 6.5 X86_64

openresty 版本: openresty-1.13.6.1.tar.gz

2、安装 openresty(nginx) 需要安装的额外包

我在装的时候报错,缺少了以下的包,执行 yum 安装命令即可.

安装 nginx 报错:
./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using --without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using --with-pcre=<path> option.

解决方案
yum -y install pcre-devel

./configure: error: SSL modules require the OpenSSL library.

解决方案:
yum -y install openssl openssl-devel

3、下载安装包(根据自己操作系统下载相应的即可)

下载地址:http://openresty.org/en/download.html

4、上传到 linux 服务器,解压安装

1). 上传使用 lrzsz 组件,没有的话,可以使用 yum 命令安装

yum install lrzsz

文件上传路径 /opt/softwares

2). 解压:tar -zxvf openresty-1.13.6.1.tar.gz

3). 安装:

cd openresty-1.13.6.1
./configure -j2 --prefix=/opt/modules/openresty-1.13.6.1
make -j2 make install

4). 配置环境变量

配置文件路径 : ~/.bash_profile

#for openresty
export OPENRESTY_HOME=/opt/modules/openresty-1.13.6.1
export PATH=$PATH:$OPENRESTY_HOME/bin

5). 验证配置

[bamboo@hadoop-senior bin]$ openresty -V
nginx version: openresty/1.13.6.1
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-18) (GCC)
built with OpenSSL 1.0.1e-fips 11 Feb 2013
TLS SNI support enabled
configure arguments: --prefix=/opt/modules/openresty-1.13.6.1/nginx --with-cc-opt=-O2 --add-module=../ngx_devel_kit-0.3.0 --add-module=../echo-nginx-module-0.61 --add-module=../xss-nginx-module-0.05 --add-module=../ngx_coolkit-0.2rc3 --add-module=../set-misc-nginx-module-0.31 --add-module=../form-input-nginx-module-0.12 --add-module=../encrypted-session-nginx-module-0.07 --add-module=../srcache-nginx-module-0.31 --add-module=../ngx_lua-0.10.11 --add-module=../ngx_lua_upstream-0.07 --add-module=../headers-more-nginx-module-0.33 --add-module=../array-var-nginx-module-0.05 --add-module=../memc-nginx-module-0.18 --add-module=../redis2-nginx-module-0.14 --add-module=../redis-nginx-module-0.3.7 --add-module=../rds-json-nginx-module-0.15 --add-module=../rds-csv-nginx-module-0.08 --add-module=../ngx_stream_lua-0.0.3 --with-ld-opt=-Wl,-rpath,/opt/modules/openresty-1.13.6.1/luajit/lib --with-stream --with-stream_ssl_module --with-http_ssl_module

可以看到已经配置成功,现在可以在任何路径下敲 openresty 即可启动 openresty.

注意:

这里说下为什么是 openresty 命令,其实这个命令还是 nginx 命令,只是给 openresty 做了一个软链接.

如果安装的时候你留意一下他的输出的时候,你可以会看到上面图中的说明,ln -s 他最终指向的是 openresty 目录下的 nginx/sbin/nginx,所以你就可以理解了吧。

6). 开放 1024 以下端口

其实你输入 openresty 命令的时候,是启动不成功的,因为 nginx 里的配置默认是开放 80 端口,而 80 属于 1024以下的端口,有特殊的权限,所以直接用非 root 用户是启动不成功的,如下图所示:

[bamboo@hadoop-senior bin]$ openresty
nginx: [emerg] bind() to 0.0.0.0:80 failed (13: Permission denied)

这个时候需要做一点其他的配置即可:

[bamboo@hadoop-senior sbin]$ pwd
/opt/modules/openresty-1.13.6.1/nginx/sbin [bamboo@hadoop-senior sbin]$ ls
nginx [bamboo@hadoop-senior sbin]$ sudo chown root:root nginx [bamboo@hadoop-senior sbin]$ sudo chmod 4755 nginx [bamboo@hadoop-senior sbin]$ openresty [bamboo@hadoop-senior sbin]$ ps -ef|grep openresty
root 31314 1 0 18:09 ? 00:00:00 nginx: master process openresty
bamboo 31319 13584 0 18:09 pts/1 00:00:00 grep openresty

执行了 chown root:root nginx 和 chmod 4755 nginx ,然后直接敲 openresty 命令就可以直接运行 openresty 了,我们查看进程也可以看到 openresty 已经启动了.

7).curl localhost 的时候报 403

找到 nginx.conf 然后修改如下内容

user nobody 改为user root

重启发现可以了。

好了,openresty 的安装就到这里了。

openresty 安装的更多相关文章

  1. mac下openresty安装

    //openresty安装 http://openresty.org/ brew updatebrew install pcre openssl ./configure --prefix=/usr/l ...

  2. OpenResty 安装 drizzle-nginx-module

    1.下载drizzle模块 wget http://openresty.org/download/drizzle7-2011.07.21.tar.gz 2.安装drizzle模块 tar zxvf d ...

  3. Openresty安装及使用配置(OPENRESTY+NGINX)

    Openresty 简介 Openresty是一个基于NGINX和Lua的高性能Web平台,内部有大量的Lua库和第三方模块,能够很方便的搭建处理高并发,扩展性高的Web平台和动态网关,充分利用 Ng ...

  4. Openresty 安装第三方插件

    Openresty 安装第三方插件 程序媛没有夜生活 2016.08.02 15:33* 字数 167 阅读 1283评论 0喜欢 2 在安装之前,我们先来看一下我们现有的模块. 1.将需要安装的插件 ...

  5. OpenResty 安装配置

    0. 说明 1. Windows 下安装 下载软件包 openresty-1.13.6.1-win32.zip ,解压即可食用. [开启] 直接运行 nginx.exe 在 Windows 的命令窗口 ...

  6. openresty安装文档

    一.OpenResty简介    OpenResty是一个基于 Nginx与 Lua的高性能 Web平台,其内部集成了大量精良的 Lua 库.第三方模块以及大多数的依赖项.用于方便地搭建能够处理超高并 ...

  7. CentOS7上OpenResty安装

    1,OpenResty安装 通过repl源安装: sudo yum-config-manager --add-repo https://openresty.org/yum/cn/centos/Open ...

  8. openresty安装笔记

    目录 安装步骤: openresty安装在ubuntu下的安装 参考 安装OpenResty(Nginx+Lua)开发环境 安装步骤: # 创建目录/usr/servers,以后我们把所有软件安装在此 ...

  9. OpenResty 安装及使用(第一篇安装)

    OpenResty搭建 1.openResty介绍 OpenResty (也称为 ngx_openresty)是一个全功能的 Web 应用服务器.它打包了标准的 Nginx 核心,很多的常用的第三方模 ...

  10. Openresty 安装教程

    Openresty的简单安装方法,如需高级编译安装,请参照安装选项 1.安装配置好Yum源,不赘述此步骤 2.安装必要组件 yum install pcre-devel openssl-devel g ...

随机推荐

  1. Java内存泄漏定位

    Java虚拟机内存分为五个区域:方法区,堆,虚拟机栈,本地方法栈,程序计数器.其中方法区和堆是java虚拟机共享的内存区域,虚拟机栈,本地方法栈,程序计数器是线程私有的. 程序计数器(Program ...

  2. C++获取当前执行程序文件所在的全路径

  3. 《算法导论》——矩阵乘法的Strassen算法

    前言: 很多朋友看到我写的<算法导论>系列,可能会觉得云里雾里,不知所云.这里我再次说明,本系列博文时配合<算法导论>一书,给出该书涉及的算法的c++实现.请结合<算法导 ...

  4. Rabbitmq(7) confirm 异步模式

    //存储未确认的消息标识tagfinal SortedSet<Long> confirmSet = Collections.synchronizedNavigableSet(new Tre ...

  5. unable to auto-detect email address

    git错误:unable to auto-detect email address 2017年11月14日 08:51:08 陈君豪 阅读数:7914   idea 用git更新的时候报错,详细错误信 ...

  6. win10版office365激活序列码

    win10版office365激活序列码(在别的地方找到一个) : NKGG6-WBPCC-HXWMY-6DQGJ-CPQVG 1.在线安装Office2016预览版后它是不会自动激活的,需在Offi ...

  7. cdnbest里如何查看网站是否被缓存

    比如开启了强制缓存,如何查看缓存是否生效 本例以firefox浏览器查看,先打开浏览器,按下F12, 然后在浏览器是输入网址访问 如下图响应头里的 x-cache显示 Miss  from 就是没有缓 ...

  8. discuz代码转为html代码

    下面附件是来自discuz的一个函数文件(原来是在source/function/function_discuzcode.php位置),已稍微修改: https://files.cnblogs.com ...

  9. Python+Selenium学习--cookie处理

    场景 有时候我们需要验证浏览器中是否存在某个cookie,因为基于真实的cookie 的测试是无法通过白盒和集成测试完成的.webdriver 可以读取.添加和删除cookie 信息.webdrive ...

  10. 对话框改变颜色 宽度沾满屏幕 Dialog

    首先在style.xml中定义一个对话框样式,这里可以修改颜色: //对话框沾满整个屏幕的宽度 <style name="DialogShareTheme" parent=& ...