Analyze NGINX Configs

This guide explains how to use the Analyzer to inspect nginx conf files for issues.


This documentation applies to NGINX Instance Manager 2.0.0 and later.


Analyze NGINX configs with the web interface

To inspect NGINX configuration files using the Analyzer in the NGINX Instance Manager web interface, take the following steps:

  1. Open the NGINX Instance Manager web interface and log in.
  2. On the left menu, select Instances.
  3. On the Overview page, select an instance’s hostname to analyze its configs.
  4. On the analyzer pane, select a .conf file from the list. The contents of the file are displayed.
  5. Update the .conf file as needed. As you make changes, the analyzer checks your configuration when you move off the line you’re editing.
  6. (Optional) To publish the changes, select Publish.
  7. (Optional) To save the changes as a template, select Save As and then give the template a name. To view the saved templates, select Config Templates in the left menu.

Editor UI

Analyze NGINX configs using the API

To inspect NGINX configuration files using the NGINX Instance Manager REST API, send a POST request similar to the following example to the Analysis endpoint:

curl -X POST "https://nms.example.com/api/platform/v1/analysis" -H  "Content-Type: application/json" -H "Authorization: Basic <auth token>" -d "
{
  "rootDir": "/etc/nginx",
  "files": [
      {
        "contents": "dXNlciB3d3ctZGF0YT<-- base64-encoded file -->Agb247CiMJfQojfQo=",
        "name": "nginx.conf"
      }
  ]
}"
Parameter Description
rootDir The root path of the NGINX configuration.
files The list of NGINX configuration files to analyze.
contents The base64-encoded contents of the file. Max length is 3,000,000 characters.
name The absolute path of the configuration file.

The response looks similar to the following examples:

errors.json warnings.json