apache 泛域名解析绑定:
设置域名A记录,把 *.cn.aery.cn 绑定到你的服务器 Ip
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | |
| | NameVirtualHost *:80 | <VirtualHost*:80> | #ServerName *.cn.aery.cn | ServerAlias *.cn.aery.cn | DocumentRoot "/www/aery.cn" | | ErrorLog logs/cn.aery.cn-error_log | CustomLog logs/cn.aery.cn-access_logcommon | | <Directory/www/aery.cn> | AllowOverride All | Order allow,deny | allow from all | </Directory> | </VirtualHost> | |
nginx的泛域名解析
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | |
server{ | | listen 80; | server_name www.iiwoo.com ~^([\d\w]+).cn.iiwoo.com; | index index.htmlindex.htm index.php; | | server_name_in_redirectoff; | set $rootdir /www/my/www.iiwoo.com; | | #匹配三级域名 | if ($host~* ^([\d\w]+)\.cn\.iiwoo\.com$){ | set $rootdir /www/my/www.iiwoo.com/company_html/$1; | #三级域名中有访问指定的目录则重定向到相应的二级域名下 | # rewrite "^.+upload/?(.*)$"http://upload.w3cgroup.com/$1 permanent; | # rewrite "^.+ijc/?(.*)$"http://ijc.w3cgroup.com/$1 permanent; | # break; | } | #匹配二级域名 | if ($host~* ^([\d\w]+)\.iiwoo\.com$){ | set $rs1 $1; | } | | root $rootdir; | #root /www/my/www.iiwoo.com; | | if ($request_filename!~* /(index\.php|images|robots\.txt|styles|templates|company_html|resources)){ | rewrite ^/(.*)$/index.php?$1last; | } | | location ~ .*\.php?$ | { | includefastcgi.conf; | includefastcgi_params; | } | | location ~ /\.ht{ | deny all; | } | } | |