zoukankan      html  css  js  c++  java
  • thinkphp配置到二级目录,不配置到根目录,访问除首页的其他路径都是404报错

    1.在nginx的配置里面,进行重定向

    vi /etc/nginx/conf.d/default.conf

    2.进入编辑

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

    这样访问ip/thinkphp/public/index/index/index,会报404,但是会转去请求

    /thinkphp/public/index.php/index/index/index再返回,就能显示正确的数据了
    /thinkphp/public/可以根据你自己写的目录进行修改配置,想写到里面就写到哪里,并不受约束,在nginx的配置里面替换掉就可以了
    就在这个thinkphp框架里面,写对数据库的操作,和请求的url

    3.重启服务器

    service nginx restart
    
    
  • 相关阅读:
    生成 n 位验证码的函数
    delphi的procedure of object
    delphi 文本 记录 流式 读写文件
    delphi save .dfm to .txt
    delphi xml
    delphi json
    delphi http server
    dac FDMemTable
    dac oracle
    dac mssql server
  • 原文地址:https://www.cnblogs.com/chenyi4/p/12332092.html
Copyright © 2011-2022 走看看