共计 2185 个字符,预计需要花费 6 分钟才能阅读完成。
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