Get the first letter of subdomain as variable

Solution 1:

Following approach might work too:

server_name ~^(?<subdomain>(?<firstletter>\w)\w+)\.development\.test$;

location / {
    root /var/www/test/$firstletter/$subdomain;
    try_files $uri $uri/ =404;
}