无为清净楼资源网 Design By www.qnjia.com

今天在用tp5做项目的时候发现,前台是可以绑定默认到index模块的,但是后台不好弄,于是查了一下手册,按照手册上说的,复制了index.php改为admin.php,作为后台的入口文件,于是域名/admin.php就可以访问后台了(默认是admin模块的index控制器的index方法),虽然可以访问了,但是我是个完美主义者,或者说室友强迫症的人,我觉得admin.php的.php看上去很是刺眼,要是能去掉就更好了,于是我就想到了把nginx的配置改一下,抱着试一试的态度,结果还是挺满意的,去掉了尾巴看上去爽多了,下面贴上代码

入口文件admin.php

<"htmlcode">
<"htmlcode">
server {
  listen  80;
  server_name www.tpmall.com tpmall.com;
  root "F:/phpStudy/WWW/tpmall/public";
  location / {
   index index.html index.htm index.php admin.php;
   #autoindex on;

   if (!-e $request_filename){
    rewrite ^(.*)$ /index.php?s=/$1 last;
   }
   if (!-e $request_filename){
    rewrite ^(.*)$ /admin.php?s=/$1 last;
   }

  }
  location ~ \.php(.*)$ {
   fastcgi_pass 127.0.0.1:9000;
   fastcgi_index index.php;
   fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
   fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
   fastcgi_param PATH_INFO $fastcgi_path_info;
   fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
   include  fastcgi_params;
  }
}
标签:
tp5多入口设置,tp5多入口配置,tp5多入口

无为清净楼资源网 Design By www.qnjia.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
无为清净楼资源网 Design By www.qnjia.com