当前位置: 移动技术网 > 网络运营>服务器>nginx > Nginx配置PATHINFO隐藏thinkphp index.php

Nginx配置PATHINFO隐藏thinkphp index.php

2019年05月24日  | 移动技术网网络运营  | 我要评论

nginx配置pathinfo隐藏index.php
nginx配置文件里放入这段代码

server { 
  listen    80;
  default_type text/plain;
  root /var/www/html;
  index index.php index.htm ;
 #隐藏index.php
  location / {
     if (!-e $request_filename) {
          #一级目录
         # rewrite ^/(.*)$ /index.php/$1 last;
          #二级目录
          rewrite ^/myapp/(.*)$ /myapp/index.php/$1 last;
       } 
  }
 #pathinfo设置
    location ~ \.php($|/) {
      fastcgi_pass  127.0.0.1:9000;
      fastcgi_index index.php;
      fastcgi_split_path_info ^(.+\.php)(.*)$;
      fastcgi_param  path_info $fastcgi_path_info;
      fastcgi_param script_filename  $document_root$fastcgi_script_name;
      include    fastcgi_params;
    }
 }

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网