nginx实现子域名访问TP不同的分组

nginx 代码:
location   /  {
        root   /data /wwwroot /pai;
        index index.html index.php;
       if  ( ! -e $request_filename) {
        rewrite   ^(. *)$   /index.php ?s =$ 1  last;
          break;
      }

       if  ($host   =  wap.pai.com) {
          rewrite   ^(. *)$   /wap.php ?s =$ 1  last;
            break;
      }

    }

TP代码:
 pai/ index.php  --> 主域名
 pai/ wap.php    --> wap域名
 
 // 不同入口文件设置不同的分组常量
 define('WEB_NAME', 'Wap');
 // config 下 默认分组名 采用WEB_NAME常量
 'DEFAULT_GROUP' => WEB_NAME,
 // at least thinkphp 3.1.2+

猜你喜欢

转载自blog.csdn.net/timerlau/article/details/38078063