直接上代码
if ( $host = 'e.xhcss.com' ){ set $subdomain "/e"; } if ( $host = 'eg.xhcss.com' ){ set $subdomain "/eg"; } if ( $host = 'test3.wehudong.cn' ){ set $subdomain "/sb"; } if ( $host = 'm.xhcss.com' ){ set $subdomain "/m"; } location ~ /(data|templets|uploads|html|images|xh|special|st|static)/.*\.(php|php5)?$ { deny all; }