A variable in nginx.conf that changes when NGINX server is restarted -


in nginx.conf file, there variable changes when nginx server restarted?
or how implement customized variable changes when nginx server restarted?

i have tried use set directive , geo directive follow:

set $timestamp '$time_iso8601'; 

it change http request.

could this? thanks!

as far know there not variable containing built nginx.

i'm assuming there outside system handling restarts (or reloads, more common) themselves, systemd, supervisord, etc.

in case, can have script generates file sets variable, loaded when nginx reads configuration.

for example, `/usr/local/nginx/conf/restart_var.conf' might contain:

set $custom_nginx_restart "2017-07-01 3:15:00z"; 

you include in server block.

the generated script like:

echo "set \$custom_nginx_restart `date`;" > /usr/local/nginx/conf/restart_var.conf 

alternatively, can generate like:

map $http_host $custom_nginx_restart {     default "2017-07-03 3:15:00z"; } 

this can included in http block.

note apply both on reloads , restart.


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -