• tp项目部署到宝塔,运行nginx时无法访问首页之外的页面


    http://www.upwqy.com/details/254.html

    tp项目 部署到宝塔里面 运行环境nginx

    直接访问首页是可以访问的。但是请求其他的接口的时候 报404 .

    需要把下面这段代码加到里面

    location / {        
         index  index.php index.html index.htm;       
         #如果请求既不是一个文件,也不是一个目录,则执行一下重写规则         
         if (!-e $request_filename)         {    
           #地址作为将参数rewrite到index.php上。          
           rewrite ^/(.*)$ /index.php?s=$1;            
           #若是子目录则使用下面这句,将subdir改成目录名称即可。            
           #rewrite ^/subdir/(.*)$ /subdir/index.php?s=$1;        
        }    
    }

  • 相关阅读:
    新人讲解
    为人处世
    项目管理
    读书
    游戏
    总结反思
    地图相关
    产品经理
    摄影
    Java 邮件发送
  • 原文地址:https://www.cnblogs.com/cuizhenyu/p/14604961.html
Copyright © 2020-2023  润新知