您的位置:首页 > 运维架构 > Nginx

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

2014-07-24 08:46 225 查看
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+
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  nginx