Welcome! Log In Create A New Profile

Advanced

Re: Nginx http module putting config in NGX_MAIN_CONF

Maxim Dounin
March 20, 2012 08:54AM
Hello!

On Tue, Mar 20, 2012 at 05:23:47PM +0530, vivek goel wrote:

> hi,
> I want to put variable inside nginx NGX_MAIN_CONF
>
> I want written code like this
>
> { ngx_string("mydata"),
> NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1,
> ngx_conf_set_str_slot,
> 0,
> offsetof(ngx_http_my_main_conf_t, my_data),
> NULL },
>
>
> But when I put in in configuration file
> worker_processes 2;
> mydata "a";
>
> I am getting following error
> nginx: [emerg] unknown directive "mydata"
>
> How to fix this ?

You can't define global directives from a http module. Either use
NGX_HTTP_MAIN_CONF instead (and the directive will be available in
http{} section), or define a core module (with module type set
to NGX_CORE_MODULE).

Maxim Dounin

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

Nginx http module putting config in NGX_MAIN_CONF

goelviek2011@gmail.com 1869 March 20, 2012 07:54AM

Re: Nginx http module putting config in NGX_MAIN_CONF

Maxim Dounin 763 March 20, 2012 08:54AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 167
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready