账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    ThinkPHP V5.1.18 部署到服务器上如何去掉public/index.php也能访问
    29
    0

    ThinkPHP V5.1.18 部署到服务器上如何去掉public/index.php也能访问

    http://abc.com/public/index.p...

    现在需要按如上链接链接规则才能访问,我想要去掉/public/index.php像如下链接一样能访问

    http://abc.com/index/index/index

    下面是我的Nginx配置文件,如果我把配置文件里root这一项改成/var/wwwroot/abc/public时,访问http://abc.com/index.php就报5...,可我已经把thinkphp的debug设为true了,也没有报详细错误。

    server
        {
            listen 80;
            server_name abc.com ;
            index index.html index.htm index.php default.html default.htm default.php;
            root  /var/wwwroot/abc;
    
            location / {
                if (!-e $request_filename) {
                    rewrite ^(.*)$ /index.php?s=/$1 last;
                    break;
                }
            }
            
            location ~ [^/]\.php(/|$)
            {
                fastcgi_pass  unix:/tmp/php-cgi.sock;
                fastcgi_index index.php;
                include fastcgi.conf;
                include pathinfo.conf;
            }
    
            location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
            {
                expires      30d;
            }
    
            location ~ .*\.(js|css)?$
            {
                expires      12h;
            }
    
            location ~ /.well-known {
                allow all;
            }
    
            location ~ /\.
            {
                deny all;
            }
    
            access_log  /var/wwwlogs/abc.com.log;
        }
    0
    打赏
    收藏
    点击回答
        全部回答
    • 0
    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部