nginx 源码(3)调试
来源:互联网 发布:mac mini什么时候更新 编辑:程序博客网 时间:2024/06/08 00:00
接上一篇
nginx运行的时候以后台进程运行,一个master和3个process进程,为了方便调试,需要改一下这个配置。
这里直接改源码,为了重新make方便,先修改Makefile
从原来的
clean: rm -rf Makefile objs
修改为:
clean: rm -rf nginx objs/ngx_modules.o objs/src/core*.o objs/src/event/*.o objs/src/event/modules/*.o objs/src/http/*.o objs/src/http/modules/*.o objs/src/http/modules/proxy/*.o objs/src/os/unix/*.o
这样make clean之后不会全部删除Makefile文件。
把core/nginx.c中与daemon和多进程相关的代码注释掉:
/* if (!ngx_inherited && ccf->daemon) { if (ngx_daemon(cycle->log) == NGX_ERROR) { return 1; } ngx_daemonized = 1; } */
和
printf("[main] to start ngx_single_process_cycle\n"); ///if (ngx_process == NGX_PROCESS_MASTER) { /// ngx_master_process_cycle(cycle, &ctx); ///} else { ngx_single_process_cycle(cycle, &ctx); ///}
我在上面加了一个printf,因为nginx直接在console中运行,验证打印,同时为了后续启动方便,把conf/nginx.conf中的端口号改为8080,重新make运行,可以看到控制台打印了输出。浏览器访问http://localhost:8080, 同样返回success,其他的日志信息还是输出在logs目录下的文件中。
0 0
- nginx 源码(3)调试
- Nginx 源码学习(一) nginx的跟踪与调试
- nginx源码分析--GDB调试
- 使用gdb调试nginx源码
- 使用gdb调试nginx源码
- nginx源码分析--使用GDB调试nginx
- nginx源码分析--使用GDB调试(strace、 pstack )
- nginx源码分析--使用GDB调试
- nginx源码分析--使用GDB调试
- nginx源码分析--使用GDB调试
- nginx模块_使用gdb调试nginx源码
- nginx模块_使用gdb调试nginx源码
- nginx模块_使用gdb调试nginx源码
- nginx模块_使用gdb调试nginx源码
- nginx模块_使用gdb调试nginx源码
- nginx源码分析(3)- 自动脚本
- nginx源码分析(3)- 自动脚本
- nginx源码分析--module开发(3)
- Android网络工具
- 第2周项目4-图书馆的书
- 字体图标 icon font
- 20个非常有用的Java程序片段
- Poj 2175 Evacuation Plan (消圈算法)
- nginx 源码(3)调试
- 原来椭圆在平移的同时绕型心旋转,极大值点的轨迹是漂亮的曲线
- Xcode中创建Workspace
- hdu 2222 Keywords Search(ac自动机模板题)
- Mac如何更改maven的java版本
- 80个Python经典资料(教程+源码+工具)汇总——下载目录
- IO-02. 整数四则运算
- Number of 1 Bits
- 黑马程序员--java基础复习之数组