server {
listen 80;
server_name *.xx.com;
access_log off;
index index.html index.htm index.php;
root /data/wwwroot/www.xx.com;
if ( $host != 'www.xx.com' ) {
rewrite (.*).xx.com www.xx.com/$1 ;
}
www.xx.com 根目录/data/wwwroot/www.xx.com;
bj.xx.com 是要指向 /data/wwwroot/www.xx.com/bj
这样完美