zhijuefe 大佬有话说 :
*.abc.com 泛域名怎么反代?
已知:
1 前端服务器和后端服务器都是 宝塔+nginx
2 网站有几千个二级域名,所以需要开启泛域名*.abc.com
3 反向代理需要开启缓存
求解:
前端服务器如何设置泛域名*.abc.com反向代理规则?
#PROXY-START/
location~* .(php|jsp|cgi|asp|aspx)$
{
proxy_pass http://abc.com;
proxy_set_header Host abc.com;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header REMOTE-HOST $remote_addr;
}
location /
{
proxy_pass http://abc.com;
proxy_set_header Host abc.com;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header REMOTE-HOST $remote_addr;
add_header X-Cache $upstream_cache_status;
#Set Nginx Cache
proxy_ignore_headers Set-Cookie Cache-Control expires;
proxy_cache cache_one;
proxy_cache_key $host$uri$is_args$args;
proxy_cache_valid 200 304 301 302 31536000m;
expires 12h;
}
#PROXY-END/
llmwxt 大佬有话说 :
帮顶,技术大佬们
帮帮楼主吧!
:hug::hug::hug:
maintell 大佬有话说 :
宝塔没用过,下面的代码是可以的
server {
listen 80;
server_nameadb.com *.adc.com;
index index.html;
root html;
location / {
proxy_set_headerHost$host;
proxy_set_headerX-real-ip $remote_addr;
proxy_set_headerX-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://10.0.0.252:18080;
}
}