laravel学习笔记(五):路由报 http 404 错误,lnmp一键安装包报 http 500 错误

    技术2024-10-08  57

    1. 路由报 http 404 错误

    错误场景描述: (1)服务器使用的是nginx (2)域名根目录下能够正常访问欢迎页 (3)访问配置在routes目录下的所有路由均报404(除域名根目录)

    解决办法 在nginx服务器配置添加

    location / { try_files $uri $uri/ /index.php?$query_string; }

    2. lnmp一键安装包报 http 500 错误

    错误场景描述: (1)使用的是lnmp一键安装包(lnmp.org) (2)能够正常访问public/index.php

    解决办法 在文件/usr/local/nginx/conf/fastcgi.conf中,找到并注释下面一行

    fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root/:/tmp/:/proc/";
    Processed: 0.012, SQL: 12