技术解析
目前的需求是*.example.com
反代到 hosts 中指定的*.example.com
比如 1.example.com
反代到 1.example.com
不知 proxy_pass 中的变量该如何写,直接写死一个 http://a.example.com
是可以成功反代的
请教 dalao 如何正确的写通配符
server {
listen 80;
listen 443 ssl http2;
s大带宽服务器erver_name ~^(.*)\.example\.com$;
include ssl.conf;
location / {
proxy_pass http://$1.example.com;//这边应该怎么写?
proxy_redirect off;
proxy_buffering off;
#proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Protocol $scheme;
}
}