I've got several virtual hosts ("server {...}") with the same regexp in `location' directive, but different actions for. E.g.:
server {
server_name first_name.com
...
location ~* ^.+\.(zip|tar|gz|bz2)$ {
root /var/www/first_name.com/archives/
}
...
}
server {
server_name second_name.com
...
location ~* ^.+\.(zip|tar|gz|bz2)$ {
try_files /arch/storage/$uri /arch/another_storage/$uri =404;
}
...
}
When I need to adjust this regexp ("^.+\.(zip|tar|gz|bz2)$"), I have to edit each virtual host in turn. Is there any possibility to use variable in `location'? E.g.:
server {
...
set $regexp "(zip|tar|gz|bz2)";
location ~* ^.+\.${regexp}$ {
root /var/www/first_name.com/archives/
}
...
}
Then I'd just `include' common setting for each virtual host.
Or is there any other way to do something like that?
yz-ripe