Le nginx HttpEchoModule me donne access à des variables nginx individuelles:
location /whathost { echo "This host is $http_host"; }
Je veux voir toutes les variables disponibles et leurs valeurs, similaires à la sortie de set
(w / o args) en bash.
Est-ce possible?
Je ne pense pas qu’il existe un moyen intégré pour afficher toutes les variables. Mais si vous regardez la source, elles semblent être définies dans: src / http / ngx_http_variables.c
Recherchez ngx_ssortingng
. Voici quelques awk pour les imprimer: awk -F\" '/[^\w]ngx_ssortingng[^\w]/ {printf "%s:\t$%s\n", $2, $2}' src/http/ngx_http_variables.c
Ensuite, vous pouvez écrire votre propre fonction:
location = /set { default_type text/plain; return 200 " # insert awk output here <- "; }
Vous pouvez trouver la source ici: http://hg.nginx.org/nginx
Ou vous pouvez voir les variables que j'ai trouvées ici: http://pastie.org/9992530