# How to iterating all server context in init\_module function

**URL:** <https://www.ruby-forum.com/t/how-to-iterating-all-server-context-in-init-module-function/197870>\
**Category:** NGINX\
**Created:** [October 21, 2010, 6:27pm UTC](https://www.ruby-forum.com/t/how-to-iterating-all-server-context-in-init-module-function/197870 "2010-10-21T18:27:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![okkezSS](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/85f322/32.png) [@okkezSS](https://www.ruby-forum.com/u/okkezSS)\
**Post date:** [October 21, 2010, 6:27pm UTC](https://www.ruby-forum.com/t/how-to-iterating-all-server-context-in-init-module-function/197870/1 "2010-10-21T18:27:27Z")

</div>

I need a clue for my problem when building my first module:

in nginx.conf i set something like this:

http {  
server {  
listen 80;  
server\_name serverA;  
UploadStoragePath /temp/A;  
#blah etc…  
}  
server {  
listen 80;  
server\_name serverB;  
UploadStoragePath /temp/B;  
#blah etc…  
}  
}

i have a server context variable:

typedef struct {  
ngx\_path\_t \*UploadStoragePath;  
ngx\_str\_t AdminEMailAddress;  
} ngx\_http\_testing\_srv\_conf\_t;

static char \*ngx\_http\_testing\_merge\_srv\_conf(ngx\_conf\_t \*cf, void  
\*parent, void \*child)  
{  
// i successfuly set “UploadStoragePath” variable for each server  
// here  
}

then, i want to set “AdminEMailAddress” variable in init\_module  
function:

static ngx\_int\_t ngx\_http\_testing\_init\_module(ngx\_cycle\_t \*cycle)  
{  
// problem here  
// how to set “AdminEMailAddress” variable for each server?  
// , something like iterating each server context here  
}

please help me.

Regards
