Skip to content
Menu
HE'S BLOG
  • Home
  • One Page
  • Home page
  • Links
  • Mac
  • Windows
  • Program
  • AI
HE'S BLOG
2023年5月14日2023年5月14日

A virtual host setting of Nginx for proxy pass

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;
		}
	}
}

近期文章

  • Dify1.3.1安装
  • Gopro 驱动下载
  • Popular models download website
  • Stable diffusion enable remote access
  • Ollama remote access

近期评论

    归档

    • 2025 年 5 月
    • 2025 年 3 月
    • 2025 年 2 月
    • 2024 年 3 月
    • 2023 年 10 月
    • 2023 年 5 月
    • 2023 年 4 月
    • 2022 年 11 月
    • 2022 年 9 月
    • 2022 年 5 月
    • 2022 年 4 月
    • 2022 年 3 月
    • 2022 年 2 月
    • 2022 年 1 月
    • 2021 年 10 月
    • 2021 年 9 月
    • 2021 年 5 月
    • 2020 年 7 月
    • 2020 年 6 月
    • 2020 年 5 月
    • 2020 年 4 月
    • 2020 年 3 月
    • 2019 年 11 月
    • 2019 年 10 月
    • 2018 年 9 月
    • 2018 年 6 月
    • 2018 年 5 月
    • 2018 年 2 月
    • 2017 年 8 月
    • 2016 年 4 月

    分类

    • AI
    • Android
    • Angular
    • Apple Hardware
    • C++
    • Docker
    • Doctine
    • ELK
    • English
    • Hadoop
    • Hbase
    • IDE&Tools
    • Ionic2
    • Javascript
    • jQuery
    • Kubernetes
    • Mac
    • PHP
    • Program
    • Scala
    • Shell
    • SQL
    • Symfony
    • Web
    • Wordpress
    • 一行命令

    其他操作

    • 登录
    • 条目 feed
    • 评论 feed
    • WordPress.org
    ©2025 HE'S BLOG | Powered by WordPress and Superb Themes!
    Menu
    HE'S BLOG
    • Home
    • One Page
    • Home page
    • Links
    • Mac
    • Windows
    • Program
    • AI