转载请注明原始地址 http://www.cnblogs.com/dongxiao-yang/p/4877799.html

一 :系统版本

1 cat /etc/issue:

CentOS release 6.2 (Final)

Kernel \r on an \m

2 cat /proc/version :

Linux version 2.6.32-220.el6.x86_64 (mockbuild@c6b18n3.bsys.dev.centos.org) (gcc version 4.4.6 20110731 (Red Hat 4.4.6-3) (GCC) ) #1 SMP Tue Dec 6 19:48:22 GMT 2011

二:openresty 安装

官网地址 http://openresty.org/

下载版本 ngx_openresty-1.9.3.1.tar.gz

1 安装依赖包:

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

2 安装openresty

(1) tar -zxvf ngx_openresty-1.9.3.1.tar.gz

(2) cd ngx_openresty-1.9.3.1

(3) 安装命令参考 https://www.nginx.com/resources/wiki/modules/lua/#lua-installation 。官方推荐的一键安装命令为

./configure --with-luajit && make && make install

这个命令会把openresty安装到默认路径 /usr/local/openresty

 安装到指定路径可以在 

./configure --prefix=/opt/openresty 指定

./configure --help 可以查看更多安装选项。

本次采用

./configure  --prefix=/opt/openresty --with-luajit && make && make install

(4)luasocket 安装

参考 http://www.cnblogs.com/dongxiao-yang/p/4878323.html

openresty作者章亦春本人是非常讨厌luascoket这个库的,在https://groups.google.com/forum/#!topic/openresty/PD6lTehlhJY

邮件里他的回复是:

这个 luasocket 必会阻塞 nginx worker 进程,让你的 nginx 服务器瞬间退化成和 Apache httpd 和 
php-fpm 一样弱 :) 绝对不要在生产环境使用它!


> 看了下这里依赖于 socket.core 模块,貌似luajit下没有这个模块,但是lua 5.1 是有的. 现在在openresty 下跑不起来. 
>

标准 Lua 5.1 解释器的官方源码发布包中绝对不会有 socket.core 这种东西 :)

> 我想问的是   luasocket 模块有什么替代么,我看 lua-resty-http 里面用了 local sock = tcp() 这个tcp 
> 的socket 这个可以替代么? 
>

ngx_lua 提供的 cosocket API 是非阻塞的,而且这个 API 故意设计成和 LuaSocket 库基本兼容,所以你把 
Lua 社区里那些基于 LuaSocket 的 Lua 库移植到 ngx_lua 环境中,也不会很费劲。

然而没有用,作者提供的cosocket在nginx的上下文使用是有限制的,所以对于需要在nginx初始化时候通过init_by_lua 部分 利用tcp获取一些启动数据的应用来说还是需要安装的,不过https://www.nginx.com/resources/wiki/modules/lua/里面 todo的列表里作者已经提出了  cosocket: add support in the context of init_by_lua. 这个目标,坐等实现。

参考 https://groups.google.com/forum/#!topic/openresty/GPgAH-75gX8

lua-resty-mysql 使用的是 ngx_lua 的 TCP cosocket API,而这个 API 在 init_by_lua 的上下文中是禁用的: http://wiki.nginx.org/HttpLuaModule#ngx.socket.tcp 注意 ngx.socket.tcp 这个接口支持的上下文(Context)列表中并没有 init_by_lua.

同时,lua-resty-mysql 库的文档中对此也有提及:https://github.com/agentzh/lua-resty-mysql#limitations

引用一下原文,“This library cannot be used in code contexts like set_by_lua*, 
log_by_lua*, and header_filter_by_lua* where the ngx_lua cosocket API 
is not available.”

安装完毕,nginx位于/opt/openresty/nginx/路径下,可以各种配置了。

三 nginx error_log 和  ngx.log api

nginx配置会有一个error_log属性,比如下面

error_log  /opt/logs/nginx/error/ng_err.log;

这个日志是nginx本身产生的日志,设置成info级别后在nginx启动时可以看到更多的信息

2015/10/15 16:22:40 [notice] 10439#0: using the "epoll" event method

2015/10/15 16:22:40 [notice] 10439#0: openresty/1.9.3.1

2015/10/15 16:22:40 [notice] 10439#0: built by gcc 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC)

2015/10/15 16:22:40 [notice] 10439#0: OS: Linux 2.6.32-220.el6.x86_64

2015/10/15 16:22:40 [notice] 10439#0: getrlimit(RLIMIT_NOFILE): 65536:65536

2015/10/15 16:22:40 [notice] 10440#0: start worker processes

2015/10/15 16:22:40 [notice] 10440#0: start worker process 10441

2015/10/15 16:22:40 [notice] 10440#0: start worker process 10442

2015/10/15 16:22:40 [notice] 10440#0: start worker process 10444

2015/10/15 16:22:40 [notice] 10440#0: start worker process 10445

2015/10/15 16:22:40 [notice] 10440#0: start worker process 10446

2015/10/15 16:22:40 [notice] 10440#0: start worker process 10447

2015/10/15 16:22:40 [notice] 10440#0: start worker process 10448

...........................

另外还有一种log是在nginx lua模块调用ngx.log(log_level, ...) api接口时产生的err.log,这个日志位于nginx 目录logs文件夹下,调用ngx.log() api

输出的日志都在这个文件里

												

openresty nginx 安装过程记录的更多相关文章

  1. nginx安装过程,报错处理:make[1]: *** [objs/addon/src/bson.o] Error 1

    nginx安装过程中,经常会有各种错误: 具体安装步骤这里不做说明,网上一搜大把: 主要分析安装过程中遇到的问题 在make编译的时候,若报如下错误: cc1: warnings being trea ...

  2. Ubuntu14.04 Tomcat 安装过程记录

    Ubuntu14.04 Tomcat 安装过程记录 检查java的版本 zhousp@ubuntu:~$ sudo java -version [sudo] password for zhousp: ...

  3. openvswitch 2.7 安装过程记录 总结

    envswitch 2.7 安装过程记录 总结 安装思路是参考文档: http://docs.openvswitch.org/en/latest/intro/install/general/#obta ...

  4. zabbix 3.0.3 (nginx)安装过程中的问题排错记录

    特殊注明:安装zabbix 2.4.8和2.4.6遇到2个问题,如下:找了很多解决办法,实在无解,只能换版本,尝试换(2.2.2正常 | 3.0.3正常)都正常,最后决定换3.0.3 1.Error ...

  5. linux环境中,nginx安装过程

    需求描述: 记录在linux平台,nginx安装的过程. 环境描述: 操作系统:Red Hat Enterprise Linux Server release 6.6 (Santiago) 操作内核版 ...

  6. Hadoop集群中pig工具的安装过程记录

    在Hadoop环境中安装了pig工具,安装过程中碰到了一些问题,在此做一下记录:   主要安装流程参考:http://www.cnblogs.com/yanghuahui/p/3768270.html ...

  7. VMware vSphere HyperVisor安装过程记录

      作者:sdjnzqr 出处:http://www.cnblogs.com/sdjnzqr/ 版权:本文版权归作者和博客园共有 转载:欢迎转载,但未经作者同意,必须保留此段声明:必须在文章中给出原文 ...

  8. Red5 1.0.5安装过程记录

    Red5从旧的服务器切换到了github上后,截至20150702仍未更新文档.为了搭建Red5开发环境,我像无头苍蝇一样乱转了很多博客和StackOverflow.藉此记录这次安装过程,希望能够帮助 ...

  9. VMware vSphere虚拟化-VMware ESXi 5.5组件安装过程记录

    几种主要的虚拟化 ESXi是VMware公司研发的虚拟机服务器,ESXi已经实现了与Virtual Appliance Marketplace的直接整合,使用户能够即刻下载并运行虚拟设备.这为 即插即 ...

随机推荐

  1. Invalid project description overlaps the location of another project [android]

    解决办法: 1.将工程放到其他目录下,然后执行Android工程的导入,导入时可以选择“Copy projects into workspace”: 2.不用Android工程导入,而用普通的工程导入 ...

  2. SGU 135.Drawing Lines

    水题,不说了. #include <iostream> using namespace std; int f[70000]={1}; int n; int main(){ cin>& ...

  3. Java学习----一个对象怎么调用另一个对象呢?

    打包 jar cvfm test1.jar manifmest.mf teacher.class student.class test1.class 运行 java -jar test1.jar pu ...

  4. Js regular exprission

    正则表达式用于字符串处理.表单验证等场合,实用高效.现将一些常用的表达式收集于此,以备不时之需. 匹配中文字符的正则表达式: [\u4e00-\u9fa5] 评注:匹配中文还真是个头疼的事,有了这个表 ...

  5. 【Linux】常用命令

    一.文件结构     /:       根目录 /bin:    系统所需要的那些命令位于此目录. /boot:   Linux的内核及引导系统程序所需要的文件目录,GRUB或LILO系统引导管理器也 ...

  6. php——composer 1、安装使用

    Composer 是PHP中用来管理依赖(dependency)关系的工具.你可以在自己的项目中声明所依赖的外部工具库(libraries),Composer会帮你安装这些依赖的库文件. 系统要求 运 ...

  7. 利用Python读取Matlab的Mat文件内容

    手头有别人写的Matlab程序,其中用到了Mat文件.现在不想安装Matlab,却又想读取Mat文件内容,该怎么办呢? 感谢scipy!!! import scipy.io data = scipy. ...

  8. 使用Python操作Redis

    1. 安装pyredis 首先安装pip   1 2 3 4 5 6 7 8 <SHELL># apt-get install python-pip ...... <SHELL> ...

  9. App Store生存指南

    资格获取   如果已经有App Store开发帐号请跳过此节.   App Store的资格获取其实一直以来都不算难,和其它事情一样,需要的只是耐心.现在苹果对申请者的文书手续要求已经比几年前简化多了 ...

  10. EntityFramework Core使用PostgreSQL

    EntityFramework Core使用PostgreSQL 0 Asp.Net Core 项目实战之权限管理系统(0) 无中生有 1 Asp.Net Core 项目实战之权限管理系统(1) 使用 ...