Nginx > removing if from dynamic site root

I currently have the following nginx config, which is working great. e.g. For url domain1.foo.com tries to serve root /var/www/domain1 if it exists if doesn’t exist, serve root /var/www/_default server { # .. truncated .. # server_name ~^(www\.)?(?<domain>[^\.]+); root /var/www/_default; location / { if (-d /var/www/$domain) { root /var/www/$domain; } if (!-d /var/www/$domain) { root…