TP5项目如何布置到nginx服务器上

tp5项目放到nginx上经常跑不起来要么打不开,要么只能打开默认控制器,要么访问控制器就是404
打开配置文件nginx.conf
这里写图片描述
修改把$符去掉,加上这两句

fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;

好像还有种方法

location / {
        root   D:/WWW/Lifes/public;
        index  index.html index.htm index.php;

        //加入这段
        try_files $uri $uri/ /index.php?$query_string;
        if (!-e $request_filename){  
            rewrite ^/(.*) /index.php last;  
        } 
    }

OK,重启,大功告成

猜你喜欢

转载自blog.csdn.net/weixin_42161963/article/details/80537077