Help developing a block directive

Joseph Spencer spencer at kogosoftwarellc.com
Wed Jun 28 21:15:16 UTC 2017


Hello,

I'm trying to support this in my nginx.conf:

my_custom_module_block {
  directive_for_my_custom_module_block "Some value";
}

Here is how I'm setting up the commands:

  static ngx_command_t ngx_my_custom_module_commands[] = {

      {

       ngx_string("my_custom_module_block"), /* directive */

        NGX_HTTP_SRV_CONF |

        NGX_HTTP_LOC_CONF |

        NGX_CONF_NOARGS |

        NGX_CONF_BLOCK,

        my_custom_module_block, /* configuration setup function */

        0, /* No offset. Only one context is supported. */

        0, /* No offset when storing the module configuration on struct. */

        NULL

      },



     {

        ngx_string("directive_for_my_custom_module_block"), /* directive */

        NGX_CONF_TAKE1,

        ngx_directive_for_my_custom_module_block_cmd, /* configuration
setup function */
        0, /* No offset. Only one context is supported. */

        0, /* No offset when storing the module configuration on struct. */

        NULL

     },



      ngx_null_command /* command termination */

  };

Everything compiles fine; however, I receive the following error and nginx
won't start:

2017/06/28 21:02:44 [emerg] 1#1: "directive_for_my_custom_module_block"
directive is not allowed here in /etc/nginx/nginx.conf:19
nginx: [emerg] "directive_for_my_custom_module_block" directive is not
allowed here in /etc/nginx/nginx.conf:19

If anyone could be of assistance I would greatly appreciate it.

-- 
Thanks,
Joe Spencer (member)
Kogo Software LLC
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20170628/58752dce/attachment-0001.html>


More information about the nginx-devel mailing list