thinkphp5部署在lnmp服务器上 出现的404问题
2023-03-29 23:03:03
133
{{single.collect_count}}

刚部署好的lnmp服务器,将thinkphp5项目扔上去的时候 无论你访问那个url 都会404错误,这是因为config 还没有完全

配置好

远程连接桌面,进去 /usr/local/nginx/conf/enable-php.conf

在方法中加入

set $fastcgi_script_name2 $fastcgi_script_name;  
       if ($fastcgi_script_name ~ "^(.+\.php)(/.+)$") {  
           set $fastcgi_script_name2 $1;  
           set $path_info $2;  
       }  
       fastcgi_param   PATH_INFO $path_info;  
       fastcgi_param   SCRIPT_FILENAME   $document_root$fastcgi_script_name2;  

       fastcgi_param   SCRIPT_NAME   $fastcgi_script_name2;

重启即可

顺便提醒一句 如果好了之后出现

scandir() has been disabled for security reasons

那就

cd /usr/local/php/etc

搜索scandir (/scandir )后删掉,保存重启即可。

回帖
全部回帖({{commentCount}})
{{item.user.nickname}} {{item.user.group_title}} {{item.friend_time}}
{{item.content}}
{{item.comment_content_show ? '取消' : '回复'}} 删除
回帖
{{reply.user.nickname}} {{reply.user.group_title}} {{reply.friend_time}}
{{reply.content}}
{{reply.comment_content_show ? '取消' : '回复'}} 删除
回帖
收起
没有更多啦~
{{commentLoading ? '加载中...' : '查看更多评论'}}