nginx+php环境下pathinfo配置教程

      发布在:个人笔记      评论:0 条评论
<p>首先修改php的配置环境php.ini<br/></p><p><span style="color: rgb(51, 51, 51); font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;PingFang SC&quot;, Tahoma, Arial, sans-serif; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);">找到php.ini文件,搜索 cgi.fix_pathinfo=1,把前面的;符号去掉。</span></p><p><img src="https://www.80zx.com/uploadfile/ueditor/image/202511/1763130410b6aedf.png" title="24f93fb2-4b14-436d-9fbf-8c485e624b6b" alt="24f93fb2-4b14-436d-9fbf-8c485e624b6b"/></p><p>再次找到nginx配置文件针对当前网站的配置文件</p><p>在location ~ \.php(.*)$ 括号内增加</p><pre class="brush:bash;toolbar:false">fastcgi_split_path_info&nbsp;^(.+?\.php)(/.*)$;&nbsp; fastcgi_param&nbsp;PATH_INFO&nbsp;$fastcgi_path_info;&nbsp; fastcgi_param&nbsp;SCRIPT_NAME&nbsp;$fastcgi_script_name;</pre><p><img src="https://www.80zx.com/uploadfile/ueditor/image/202511/1763130991ca00d8.png" title="7bbe3d21-e2c3-42c3-ad72-3733eb36fc04" alt="7bbe3d21-e2c3-42c3-ad72-3733eb36fc04"/></p>
热门推荐