I am trying to set a dynamic expires header. This is basically my config:
# http context
map $request_uri $expires_time {
default -1;
*.js max;
}
server {
# server_name/proxy_headers/listen/ssl
location / {
expires $expires_time;
proxy_pass http_serverving_docker_container.docker;
}
}
I am getting this error message on a nginx -t
:
nginx: [emerg] "expires" directive invalid value in /etc/nginx/sites-enabled/config:57 # <- this is the expires line
nginx: configuration file /etc/nginx/nginx.conf test failed
If I exchange it with a number (e.g.: -1), then everything works perfectly fine. Am I not allowed to use variables here? I perused the manual page for expires and haven't seen a mention of that.
Additional information: Nginx version: nginx/1.6.2 Linux version: Debian GNU/Linux 8 (jessie)
You're using an obsolete version of nginx on an obsolete Linux distribution. Both need to be upgraded ASAP.
In particular:
expires
directive requires at least version 1.7.9.