问题:linu+nginx+pathinfo+thinkphp3.1.3下分组泛域名解析,某个域名找不到模板,但实际存在,分析估计是nginx的pathinfo有问题,但是网上找N多配置pathinfo都未能解决。
域名:www.43y.com.cn
错误:news.43y.com.cn 找得到分组模块程序,但dispaly时模板文件找不到,实际存在,意思模板文件被重定向了,
1、apache和win+iis都一切正确,唯一nginx配置了pathin也不正常。
nginx的pathinfo配置。
server {
listen 80;
server_name www.43y.com.cn 43y.com.cn *.43y.com.cn;
root /webroot/43y.com.cn/www;
location / {
index index.htm index.html index.php;
#如果文件不存在则尝试TP解析
try_files $uri /index.php$uri;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location ~ .+\.php($|/) {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
#设置PATH_INFO,注意fastcgi_split_path_info已经自动改写了fastcgi_sc
#后面不需要再改写sc
fastcgi_split_path_info ^(.+\.php)(/.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
#加载Nginx默认"服务器环境变量"配置
include fastcgi.conf;
}
}
网站config.inc.php配置如下
$appConfig = array(
//异常模板(根据官方原版修改)
'ERROR_MESSAGE' =>'站点升级中……,请稍后再试~',
'TMPL_EXCEPTION_FILE' => APP_PATH.'Modules/Public/think_exception.tpl',
//VAR_FILTERS参数,对GET POST系统变量会进行过滤
'VAR_FILTERS'=>'strip_tags',
//默认主题
//'DEFAULT_THEME' => 'default',
//设置模板后缀
//'TMPL_TEMPLATE_SUFFIX'=>'.tpl',
// 显示页面Trace信息
//'SHOW_PAGE_TRACE' =>true,
//URL模式为REWRITE模式
'URL_MODEL' => 2,
//配置分组及二级域名
'APP_GROUP_LIST' => 'Index,Brand,Product,Shop,News,Tuan,Tags',
'DEFAULT_GROUP' => 'Index',
'APP_GROUP_PATH' => 'Modules', //默认Modules
'APP_GROUP_MODE' => '1', //默认0普通分组,1独立分组,目前独立分组的目录结构得手动创建
'APP_SUB_DOMAIN_DEPLOY'=>1, // 开启子域名配置
/*子域名配置
*格式如: '子域名'=>array('分组名/[模块名]','var1=a&var2=b');
*/
'APP_SUB_DOMAIN_RULES'=>array(
'www' => array('Index/Index'), // Index域名指向Index分组
'test' => array('News/News'), // Index域名指向Index分
'list' => array('Product/List'), // Product域名指向List分组
'item' => array('Product/Item'), // Product域名指向Item分组
'shop' => array('Shop/Shop'), // Shop域名指向Shop分组
'news' => array('News/News'), // News域名指向News分组
'brand' => array('Brand/Index'), // News域名指向News分组
'tuan' => array('Tuan/Tuan'), // News域名指向News分组
'tags' => array('Tags/Tags'), // News域名指向News分组
'*' => array('Brand/Brand'), // 所有品牌域名指向Brand分组
),
//Cookie通用默认设置
'COOKIE_EXPIRE' => '3600'*24*30, //30天
'COOKIE_PREFIX' => 'dls_',
//伪静态后缀.可以省略,多个后缀用|分隔(默认支持所有后缀)
'URL_HTML_SUFFIX'=>'html',
//不区分大小写,开启后,如有UserTypeAction就得写成user_type
'URL_CASE_INSENSITIVE' => true,
//模板解析替换
'TMPL_PARSE_STRING' => array(
'__UPLOAD__' => '/Uploads',
'__SUFFIX__' => '.html', //扩展名后缀
'__PUBLIC__' => '/Static'
),
//URL路由,在独立分组下面不能实现config配置!!!!!!!!!!!!!!!!!!NND
'URL_ROUTER_ON' => true,
'URL_ROUTE_RULES' => array(
//错误操作都指向404
'error'=>'ba
'addlike'=>'ba
//首页路由
'new'=>'Index/newproduct',
'hot'=>'Index/hotproduct',
'about/notice'=>'Index/notice',
'about/contact'=>'Index/contact',
'about/li
'about/sitemap'=>'Index/sitemap',
'about/introduction'=>'Index/introduction',
'all'=>'Index/read',
//新闻路由
'/^N_([A-Za-z]+)$/' => 'News/newslist?ename=:1',
'/^N_([A-Za-z]+)\/(\d+)$/' => 'News/newslist?ename=:1&p=:2',
'/^detail\/(\d+)$/' => 'News/newsdetail?id=:1',
//店铺频道规则
'/^shop\/p\/(\d+)$/'=>'Shop/index?p=:1',
'/^shop(\d+)$/'=>'Shop/shop?id=:1',
'/^shop(\d+)\/([A-Za-z]+)$/'=>'Shop/productlist?id=:1&ename=:2',
'/^shop(\d+)\/([A-Za-z]+)\/(\d+)_(\d+)_(\d+)$/' => 'Shop/productlist?id=:1&ename=:2&price=:3&orderid=:4&p=:5',
//品牌频道规则,列表productlist必须相同才能相互访问
'/^about$/'=>'brand/about',
'/^shop$/'=>'brand/shop',
'/^news$/'=>'brand/news',
'/^([A-Za-z]+)$/' => 'brand/productlist?id=:1&ename=:2',
'/^([A-Za-z]+)\/(\d+)_(\d+)_(\d+)$/' => 'brand/productlist?id=:1&ename=:2&price=:3&orderid=:4&p=:5',
//产品路由,列表productlist必须相同才能相互访问
'/^product(\d+)$/' => 'Item/productdetail?id=:1', //产品详情页的
'/^([A-Za-z]+)$/' => 'list/productlist?ename=:1',
'/^([A-Za-z]+)\/(\d+)_(\d+)_(\d+)$/' => 'list/productlist?ename=:1&price=:2&orderid=:3&p=:4',
//跳转路由
'gopage/:type/:id\d$' => 'ba
//规则里的伪静态扩展名如.html在最后可以忽略
//标签跳转
'/^tags(\d+)$/' => 'Tags/Tags?tagsid=:1', //内页的流行标签
'/^tags(\d+)\/p\/(\d+)/U' => 'Tags/Tags?tagsid=:1&p=:2', //热门标签(带分页)
'/^tags\_(\d+)\_(.*)$/' => 'Tags/Tags?p=:1&keyword=:2', //热门标签(带分页)
'/^tags_(.*)$/' => 'Tags/Tags?keyword=:1', //内页的流行标签
),
);
最佳答案