Nginx如何编译连接

发布时间:2021-12-08 11:48:22 作者:小新
来源:亿速云 阅读:124

这篇文章将为大家详细讲解有关Nginx如何编译连接,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。

nginx 组织过程

针对http geo模块连接过程进行示范

1.configure

path:auto/configure

. auto/options
...

2.options 参数

某个配置是否开启

 --without-stream_geo_module        disable ngx_stream_geo_module
  --with-debug                       enable debug logging

HTTP_GEO变量被设置为YES, geo模块开启.

    if [ $HTTP_GEO = YES ]; then
        have=NGX_HTTP_X_FORWARDED_FOR . auto/have

        ngx_module_name=ngx_http_geo_module
        ngx_module_incs=
        ngx_module_deps=
        ngx_module_srcs=src/http/modules/ngx_http_geo_module.c
        ngx_module_libs=
        ngx_module_link=$HTTP_GEO

        . auto/module
    fi

3.objs/ngx_modules.c

4.objs/Makefile

eg:ngx_http_geo_module.o模块的生成

objs/src/http/modules/ngx_http_geo_module.o:	$(CORE_DEPS) $(HTTP_DEPS) \
	src/http/modules/ngx_http_geo_module.c
	$(CC) -c $(CFLAGS) $(CORE_INCS) $(HTTP_INCS) \
		-o objs/src/http/modules/ngx_http_geo_module.o \
		src/http/modules/ngx_http_geo_module.c

5.验证nginx中已经连接了目标模块

➜  nginx git:(hyh_test) ✗ nm objs/nginx | grep geo_mod
00000001000a5420 D _ngx_http_geo_module
00000001000bdf68 b _ngx_http_geo_module_ctx
➜  nginx git:(hyh_test) ✗ 
➜  nginx git:(hyh_test) ✗ nm objs/nginx | grep mytest 
0000000100071860 t _ngx_http_mytest_block
00000001000a5500 d _ngx_http_mytest_commands
00000001000a5570 D _ngx_http_mytest_module
00000001000bdfb8 b _ngx_http_mytest_module_ctx
➜  nginx git:(hyh_test) ✗

关于“Nginx如何编译连接”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,使各位可以学到更多知识,如果觉得文章不错,请把它分享出去让更多的人看到。

推荐阅读:
  1. nginx 编译新增加模块
  2. nginx的编译安装

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

nginx

上一篇:RPC框架有什么用

下一篇:Eclipse Java类编辑器里出现乱码的解决方案是怎么样的

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》