* 泛解析在DNS中解析到Nginx服务器
添加Nginx配置文件
upstream x {
server 10.0.0.x:6096; 这里的6096是后端服务,后端程序会通过$subdomain获取到abc,qedd,等主机头部,然后进行跳转
}
server {
server_name ~^(?.+).yourdomain.com$;
listen 80;
access_log logs/testb.access.log main;
error_log logs/testb.error.log;
location = /favicon.ico {
alias /root/org/favicon.ico;
}
error_page 500 502 503 504 /500.html;
location /500.html {
internal;
}
error_page 404 /404.html;
location = /robots.txt {
alias /usr/local/webserver/nginx/conf/robots.txt;
}
location / {
proxy_pass_header Server;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Scheme $scheme;
#custom header from upstream server
proxy_set_header DEFINE-REDIRECT $subdomain;
proxy_pass http://x$uri$is_args$args;
}
}