Nginx – SHOW VARIABLES equivalent for NGINX configuration variables

nginx

I help many of my clients out with their NGINX installs. I'd like to get a quick overview of all of the values of the NGINX variables, much like MYSQL does with SHOW VARIABLES: https://wow-ss.s3.amazonaws.com/HYkKlgW.png

I realize that the variables would change based on location and virtual host. I had an idea of outputting them via the add_header directive. I found that the method worked well with some variables. For instance, this would correctly output the document root path add_header var-document_root $document_root;

However, when I tried with a directive value instead of a variable, it didn't work; add_header var-server_names_hash_max_size server_names_hash_max_size; simply outputted: server_names_hash_max_size

Hoping I could get some direction with this. Thank you ahead of time

Best Answer

You can use the HTTP Echo Module to get access to individual nginx variables. Then you'd need to check out what variables are available, and then build your own route / page. There is no nginx equivalent of printenv however.