Bad Config Files

Symptom

The Edge Router is implemented by using Nginx. During the Edge upgrade process, or when changing the configuration of the Router, you might see Nginx configuration errors. When these errors occur, Edge marks all the Nginx configuration files that caused the issue to /opt/nginx/conf.d:

-rw-r--r-- 1 apigee apigee 522 Jul 20 08:41 0-default.conf.bad 
-rw-r--r-- 1 apigee apigee 577 Jul 20 08:42 0-fallback.conf 
-rw-r--r-- 1 apigee apigee 1062 Jul 20 08:18 0-map.conf 
-rw-r--r-- 1 apigee apigee 1887 Jul 20 08:42 custorg_test_default.conf.bad

Error Messages

You will not see any error messages. However, you might not be able to execute your API proxies because of the bad config files.

Possible Causes

Typically the Nginx config files are marked bad either because incorrect value(s) are set to Nginx property(ies) in the /opt/apigee/customer/application/router.properties file or incorrect changes are made to a virtual host.

Diagnosis

  1. Remove the .bad suffix from the file names in the /opt/nginx/conf.d directory so they end in .conf.
  1. Run the Nginx configtest tool to determine the reason for the failure:
    /opt/nginx/scripts/apigee-nginx configtest
    

Resolution

  1. If the config test identifies the reason for the bad config files, then fix the issue by making the appropriate changes to the specific property in the /opt/apigee/customer/application/router.properties file or virtual host.
  1. Remove the /opt/nginx/conf.d directory:
    rm -rf /opt/nginx/conf.d
    
  1. Restart the Router:
    /opt/apigee/apigee-service/bin/apigee-service edge-router restart
    
  1. You should no longer see bad config files in the /opt/nginx/conf.d directory.

If the problem persists, contact Apigee Support.

Here’s an example that shows how to fix the problem based on the information provided by the Nginx config test.

Example: Incorrect Value set for a Nginx property

  1. Let’s say you updated the property “proxy_busy_buffers_size” to 128K in the /opt/apigee/customer/application/router.properties file, as shown below:
    conf_load_balancing_load.balancing.driver.proxy.busy.buffer.size=128k 
    

This caused the config files to be marked as bad in /opt/apigee/nginx/conf.d directory.

  1. Run the Nginx configtest command to determine the reason for failure:
    /opt/nginx/scripts/apigee-nginx configtest
    nginx: [emerg] "proxy_busy_buffers_size" must be equal to or greater than the maximum of the value of "proxy_buffer_size" and one of the "proxy_buffers" in /opt/nginx/conf/nginx.conf:47
    nginx: configuration file /opt/nginx/conf/nginx.conf test failed
    

The configtest results indicates that the value for the property proxy_busy_buffers_size should be equal to or greater than proxy_buffer_size, but seems to be set with an incorrect value.

  1. Check the values set for the properties proxy_buffer_size and proxy_busy_buffers_size in the 0-default.conf file:
    proxy_buffer_size 512k;
    proxy_busy_buffers_size 128k;
    
  1. Update the value of proxy_busy_buffers_size to 512K in the /opt/apigee/customer/application/router.properties file:
    conf_load_balancing_load.balancing.driver.proxy.busy.buffer.size=512k
    
  1. Remove the /opt/nginx/conf.d folder:
    rm -rf /opt/nginx/conf.d
    
  1. Restart the router:
    /opt/apigee/apigee-service/bin/apigee-service edge-router restart
    

The issue was fixed and the bad config files were removed.