Parse Nginx configurations in a clear manner for debugging purposes
Project description
Nginx Static Analysis
Parse Nginx configurations on your host and filter for directives/values.
Largely powered by Crossplane.
Analysing your Nginx configuration
You can list any directive within your Nginx configuration. For example, show all listen
directives:
app@wifbtb-testalex-magweb-cmbl:~$ nginx-static-analysis directive listen
+------------------------------------------------------+----------------------------------------+------------------+
| File | Values | Directives |
+------------------------------------------------------+----------------------------------------+------------------+
| /etc/nginx/sites/http.testalex.hypernode.io.conf:4 | 127.0.0.1:1337 default_server | server -> listen |
| /etc/nginx/sites/http.testalex.hypernode.io.conf:16 | 8888 default_server | server -> listen |
| /etc/nginx/sites/https.testalex.hypernode.io.conf:6 | 127.0.0.1:443 ssl http2 default_server | server -> listen |
| /etc/nginx/sites/https.testalex.hypernode.io.conf:22 | 8443 ssl http2 default_server | server -> listen |
+------------------------------------------------------+----------------------------------------+------------------+
Filtering also works for values, like showing all location
blocks with value /
:
app@wifbtb-testalex-magweb-cmbl:~$ nginx-static-analysis directive location --values /
+----------------------------------------------------+--------+------------------------------------------+
| File | Values | Directives |
+----------------------------------------------------+--------+------------------------------------------+
| /etc/nginx/testsite.conf:18 | / | http -> include -> server -> location |
| /etc/nginx/sites/http.testalex.hypernode.io.conf:8 | / | server -> location |
| /etc/nginx/magento2.conf:17 | / | server -> include -> include -> location |
+----------------------------------------------------+--------+------------------------------------------+
You can search for multiple directives, as long as you specify >=n-1 values to directives. F.e., find the server_name
s and location
s that match with location=/static/
:
app@wifbtb-testalex-magweb-cmbl:~$ nginx-static-analysis directive location server_name --value /static/
+------------------------------------------------------+-----------------------+------------------------------------------+
| File | Values | Directives |
+------------------------------------------------------+-----------------------+------------------------------------------+
| /etc/nginx/monitoring.conf:5 | localhost | http -> include -> server -> server_name |
| /etc/nginx/testsite.conf:5 | magweb | http -> include -> server -> server_name |
| /etc/nginx/sites/https.testalex.hypernode.io.conf:21 | testalex.hypernode.io | server -> server_name |
| /etc/nginx/magento2.conf:23 | /static/ | server -> include -> include -> location |
+------------------------------------------------------+-----------------------+------------------------------------------+
By default it parses /etc/nginx/nginx.conf
and all includes, but you can specify the starting file:
app@wifbtb-testalex-magweb-cmbl:~$ nginx-static-analysis -f /some/other/nginx.conf directive location
...
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Close
Hashes for nginx-static-analysis-0.1.6.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 94c4e2826e511ab003fc3fe74f32e619cd8e0d1fb48bc0a7b106aa8fdda0b694 |
|
MD5 | 5e906659dcbf122b43cce0cd7f6ba1dc |
|
BLAKE2b-256 | ae55133f8ee242be14d8923c622b2209cdf993d8958ae9f73c334480e98dae5d |