server{
listen 80;
server_name domain.test.server test.server;
root /var/www/korin;
location / {
proxy_set_header Host test.server;
proxy_pass http://127.0.0.1:80;
# if ($host ~* ^(?<lev3>.+)*\.(?<lev2>.+)*\.(?<lev1>.+)*$ ) {
# rewrite ^/(.*)$ /$lev3/$lev2/$lev1/$1 break;
if ($host ~* ^(?<sub>.+)*\.test\.server$ ) {
rewrite ^/(.*)$ /$sub/$1 break;
}
}
}
server{
listen 127.0.0.1:80;
server_name test.server;
root /var/www/korin;
location / {
}
}