你好,游客 登录 注册 搜索
背景:
阅读新闻

RHEL 6.4下Nginx 1.6.0 插件开发记录

[日期:2015-07-24] 来源:Linux社区  作者:suiqu [字体:大 中 小]

RHEL 6.4下Nginx 1.6.0 插件开发记录

1. nginx的编译部署
# ./configure --with-poll_module --with-http_ssl_module --with-file-aio --with-ipv6
# make install
# cd /usr/local/nginx/sbin
# ./nginx

# ps -ef | grep nginx
root      7330    1  0 22:46 ?        00:00:00 nginx: master process ./nginx
nobody    7331  7330  0 22:46 ?        00:00:00 nginx: worker process

# ./nginx -h
nginx version: nginx/1.4.2
Usage: nginx [-?hvVtq] [-s signal] [-c filename] [-p prefix] [-g directives]

Options:
  -?,-h        : this help
  -v            : show version and exit
  -V            : show version and configure options then exit
  -t            : test configuration and exit
  -q            : suppress non-error messages during configuration testing
  -s signal    : send signal to a master process: stop, quit, reopen, reload
  -p prefix    : set prefix path (default: /usr/local/nginx/)
  -c filename  : set configuration file (default: conf/nginx.conf)
  -g directives : set global directives out of configuration file

// 停止服务
# ./nginx -s stop

2. 插件开发

参考文档:
Nginx开发从入门到精通  http://www.linuxidc.com/Linux/2015-07/120463.htm

代码目录结构:
/projects
  -nginx-1.6.0
  -nginx-http-myplugin
    --config
    --ngx_http_myplugin_module.c
    --ngx_http_myplugin_module.c


nginx-1.6.0是nginx自身的源代码目录
nginx-http-myplugin是我们的插件代码目录
 
config文件的内容:
# -*- mode:sh; -*-
ngx_addon_name=ngx_http_myplugin_module
HTTP_MODULES="$HTTP_MODULES ngx_http_myplugin_module"
NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/ngx_http_myplugin_module.c"


在/projects/nginx-1.6.0目录下运行下面命令进行编译:
./configure --with-poll_module --with-http_ssl_module --with-file-aio --with-ipv6 --add-module=../nginx-http-filerepair --with-debug

CentOS 6.2实战部署Nginx+MySQL+PHP http://www.linuxidc.com/Linux/2013-09/90020.htm

使用Nginx搭建WEB服务器 http://www.linuxidc.com/Linux/2013-09/89768.htm

搭建基于Linux6.3+Nginx1.2+PHP5+MySQL5.5的Web服务器全过程 http://www.linuxidc.com/Linux/2013-09/89692.htm

CentOS 6.3下Nginx性能调优 http://www.linuxidc.com/Linux/2013-09/89656.htm

CentOS 6.3下配置Nginx加载ngx_pagespeed模块 http://www.linuxidc.com/Linux/2013-09/89657.htm

CentOS 6.4安装配置Nginx+Pcre+php-fpm http://www.linuxidc.com/Linux/2013-08/88984.htm

Nginx安装配置使用详细笔记 http://www.linuxidc.com/Linux/2014-07/104499.htm

Nginx日志过滤 使用ngx_log_if不记录特定日志 http://www.linuxidc.com/Linux/2014-07/104686.htm

Nginx 的详细介绍:请点这里
Nginx 的下载地址:请点这里

更多RedHat相关信息见RedHat 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=10

本文永久更新链接地址:http://www.linuxidc.com/Linux/2015-07/12046.htm

linux
相关资讯       Nginx 1.6.0 插件开发  Nginx 1.6.0 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款