server {
listen 443 ssl;
listen [::]:443;
ssl_certificate /etc/nginx/ssl/cert.pem;
ssl_certificate_key /etc/nginx/ssl/key.pem;
root /var/www/html;
index index.html index.htm index.nginx-debian.html;
auth_basic "Admin";
auth_basic_user_file /etc/nginx/.htpasswd;
server_name ~^(?<subdomain>.+)\.xxxxx\.com;
location / {
resolver 8.8.8.8;
if ($subdomain ~* (\w+)\-(\w+)\-(\w+)) {
proxy_pass https://$1.$2.$3;
break;
}
if ($subdomain ~* (\w+)\-(\w+)) {
proxy_pass https://$1.$2;
break;
}
if ($subdomain ~* (\w+)){
proxy_pass https://$1.com;
}
}
}
server {
listen 443 ssl;
listen [::]:443;
ssl_certificate /etc/nginx/ssl/cert.pem;
ssl_certificate_key /etc/nginx/ssl/key.pem;
root /var/www/html;
index index.html index.htm index.nginx-debian.html;
auth_basic "Admin";
auth_basic_user_file /etc/nginx/.htpasswd;
server_name ~^(?<subdomain>.+)\.xxxxx\.com;
location / {
resolver 8.8.8.8;
if ($subdomain ~* (\w+)\-(\w+)\-(\w+)) {
proxy_pass https://$1.$2.$3;
break;
}
if ($subdomain ~* (\w+)\-(\w+)) {
proxy_pass https://$1.$2;
break;
}
if ($subdomain ~* (\w+)){
proxy_pass https://$1.com;
}
}
}
server { listen 443 ssl; listen [::]:443; ssl_certificate /etc/nginx/ssl/cert.pem; ssl_certificate_key /etc/nginx/ssl/key.pem; root /var/www/html; index index.html index.htm index.nginx-debian.html; auth_basic "Admin"; auth_basic_user_file /etc/nginx/.htpasswd; server_name ~^(?<subdomain>.+)\.xxxxx\.com; location / { resolver 8.8.8.8; if ($subdomain ~* (\w+)\-(\w+)\-(\w+)) { proxy_pass https://$1.$2.$3; break; } if ($subdomain ~* (\w+)\-(\w+)) { proxy_pass https://$1.$2; break; } if ($subdomain ~* (\w+)){ proxy_pass https://$1.com; } } }