首頁 > 運維 > Nginx > 主體

Nginx怎麼配置PATHINFO隱藏thinkphp index.php

WBOY
發布: 2023-06-03 13:18:14
轉載
881 人瀏覽過

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

server { 
  listen    80;
  default_type text/plain;
  root /var/www/html;
  index index.php index.htm index.html;
 #隐藏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;
    }
 }
登入後複製

以上是Nginx怎麼配置PATHINFO隱藏thinkphp index.php的詳細內容。更多資訊請關注PHP中文網其他相關文章!

相關標籤:
來源:yisu.com
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!