首页 > 其他 > 详细

Nginx学习记录-2 hello word 模块

时间:2015-11-06 13:17:18      阅读:388      评论:0      收藏:0      [点我收藏+]

??参考:

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中设置

Nginx学习记录-2 hello word 模块

原文:http://my.oschina.net/u/2463708/blog/526836

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!