nginx去掉index.php 只需2个步骤

 时间:2026-05-07 06:35:48

1、要编辑子站的配置文件

vi  /usr/local/nginx/conf/vhost/子站.conf

把 include enable-php.conf   注释掉这行!(或者直接dd删除)

然后在下面新曾一行  添加 

include enable-php-pathinfo.conf;   #注意后面必须带分号

2、进入目录   cd /usr/local/nginx/conf/vhost/子站.conf 

vi 子站.conf           在你的虚拟主机配置文件server段里添加以下内容:

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

3、浏览器打开 http://localhost/Home/Index/mod   访问正常!成功去掉了index.php

  • 炉石标准猎人卡组(厉害哦)
  • 汗蒸的好处与坏处
  • windows10如何更新电脑系统时间与网络时间同步
  • 检查Windows的IP设置
  • 慢性糜烂性胃炎是什么?
  • 热门搜索
    跟团旅游注意事项 成都三亚旅游 彭水旅游 新乡旅游网 冲绳岛旅游 清明上河园旅游 江西景德镇旅游攻略 法国巴黎旅游 珠海旅游网 江苏徐州旅游景点