参考:
http://blog.csdn.net/xiajun07061225/article/details/9130237
http://tengine.taobao.org/book/chapter_03.html#hello-handler
新建模块源码存放的目录
/home/fan/nginx
1)ngx_http_hello_module.c文件的编写
2)config文件的编写
修改配置文件
先修改配置文件再进行编译安装
1)/usr/local/nginx/conf/nginx.conf
编译安装
1)
./configure --prefix=/usr/local/nginx --add-module=/home/fan/nginx --conf-path=/usr/local/nginx/nginx.conf
/usr/local/nginx:Nginx安装部署后的根目录
/home/fan/nginx:ngx_http_hello_module.c和config文件所在的文件夹。
/usr/local/nginx/nginx.conf:配置文件放置路径
2)sudo make
3)sudo make install
测试
1)终端下输入命令 lynx http://127.0.0.1/test 或直接在浏览器中输入地址 http://127.0.0.1/test
2)Lynx:纯文本网页浏览器
3)127.0.0.1:回送地址,指本地机,一般用来测试。
4)/test 在配置文件nginx.conf中设置
原文:http://my.oschina.net/u/2463708/blog/526836