重慶分公司,新征程啟航
為企業(yè)提供網(wǎng)站建設(shè)、域名注冊(cè)、服務(wù)器等服務(wù)
為企業(yè)提供網(wǎng)站建設(shè)、域名注冊(cè)、服務(wù)器等服務(wù)
這篇文章將為大家詳細(xì)講解有關(guān)Nginx如何編譯連接,小編覺得挺實(shí)用的,因此分享給大家做個(gè)參考,希望大家閱讀完這篇文章后可以有所收獲。
我們提供的服務(wù)有:成都網(wǎng)站設(shè)計(jì)、網(wǎng)站建設(shè)、微信公眾號(hào)開發(fā)、網(wǎng)站優(yōu)化、網(wǎng)站認(rèn)證、海滄ssl等。為超過千家企事業(yè)單位解決了網(wǎng)站和推廣的問題。提供周到的售前咨詢和貼心的售后服務(wù),是有科學(xué)管理、有技術(shù)的海滄網(wǎng)站制作公司
/auto/configure(獲取configure的配置,生成Makefile)
objs/Makefile(由第一步生成)
make(*.o生成,連接成nginx)
針對(duì)http geo模塊連接過程進(jìn)行示范
path:auto/configure
. auto/options ...
path: auto/option
path: auto/modules
某個(gè)配置是否開啟
--without-stream_geo_module disable ngx_stream_geo_module --with-debug enable debug logging
HTTP_GEO變量被設(shè)置為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
extern 聲明目標(biāo)模塊(geo, 自定義模塊)
ngx_modules: 注冊(cè)模塊
ngx_module_names: 定義模塊名
編譯目標(biāo).o
把目標(biāo).o連接到nginx
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
ngx_http_geo_module
ngx_http_mytest_module(自定義模塊)
? 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) ?
關(guān)于“Nginx如何編譯連接”這篇文章就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,使各位可以學(xué)到更多知識(shí),如果覺得文章不錯(cuò),請(qǐng)把它分享出去讓更多的人看到。