env lost effect in single process mode

speedfirst nginx-forum at nginx.us
Mon Dec 13 10:42:06 MSK 2010

Hey, I find when I set daemon off and master_process off to enter the
dev single process mode, env simply doesn't work. My custom module
depending on that env can't find them. So I check the code and find in
ngx_single_process_cycle, ngx_set_environment is not invoked. So I add
it like fellow code. Maybe u can fix this little bug in your main nginx

ngx_single_process_cycle(ngx_cycle_t *cycle)
    ngx_uint_t  i;

    if (ngx_set_environment(cycle, NULL) == NULL) { <--- add this code
            /* fatal */

    for (i = 0; ngx_modules[i]; i++) {
        if (ngx_modules[i]->init_process) {
            if (ngx_modules[i]->init_process(cycle) == NGX_ERROR) {
                /* fatal */

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,158113,158113#msg-158113

More information about the nginx mailing list