apache nginx泛域名解析绑定

来源:互联网 发布:elmo控制器 编程 编辑:程序博客网 时间:2024/06/06 00:54

apache nginx 泛域名解析绑定

apache 泛域名解析绑定:

设置域名A记录,把 *.cn.aery.cn 绑定到你的服务器 Ip

12345678910111213141516171819


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
              allowfrom all
      </Directory>
</VirtualHost>

nginx的泛域名解析

123456789101112131415161718192021222324252627282930313233343536373839
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;
             }
      }


0 0
原创粉丝点击