How to configure NGinx with special directives in an On-Premises Edge installation

In an on-premises (customer-managed) installation of Apigee, you may wish to add a custom NGinx directive. Here is how to ensure it gets picked up when restarting the Router process.

First, read here on using Code-With-Config to configure Edge:

http://docs.apigee.com/private-cloud/latest/how-configure-edge

Also, see here for a list of NGinx directives:

https://nginx.org/en/docs/http/ngx_http_core_module.html

For this example, I've chosen a somewhat innocuous directive, recursive error pages. This is merely an example, yours may be different.

To add the custom directive, edit the customer-specific config:

vi /opt/apigee/customer/application/router.properties 

In that file, add:

conf_load_balancing_load.balancing.driver.nginx.global.http.parameters.template.extra=recursive_error_pages off; 

then, restart the Router:

apigee-service edge-router restart

This will populate the config in /opt/nginx/conf.d/0-default.conf

To sanity check, you can examine that file and you should see the appropriate update in the last line.

Please note that this information is provided as-is. Many of the directives may have adverse effects; as a rule of thumb, I would strongly suggest that you:

1) enable the directive(s) in nonprod and thoroughly test

2) review the directive(s) with your security team to weigh the pros and cons of the performance vs security aspects of any directives you wish to add.

I hope this helps. Thanks.

Version history
Last update:
‎03-22-2017 01:47 PM
Updated by: