I have the following Nginx configuration using regular expression server names, so I can easily add static sites without adding new configuration entries:
server {
server_name ~^(?<domain>.+)$;
root /home/static/sites/$domain;
access_log /var/log/nginx/$domain-static-access.log;
error_log /var/log/nginx/$domain-static-error.log;
}
This works fine for serving the site, and the access logs end up at e.g. /var/log/nginx/example.com-static-access.log as desired. But the error logs end up at /var/log/nginx/$domain-static-error.log. It does not interpolate the value of that regex capture.
Any idea how to fix that?