laravel,基本安装,重定向给我一个 500 错误

Posted

技术标签:

【中文标题】laravel,基本安装,重定向给我一个 500 错误【英文标题】:laravel, basic instalation, redirect give me back a 500 Error 【发布时间】:2018-08-08 17:32:13 【问题描述】:

我已经用 composer 基本安装了 Laravel 5.6.5,还添加了社交名流插件。

我已经阅读了一些 *** 问题,但我不明白它是否有效。

如果我使用 php artisan serve 运行 laravel,它可以工作,但如果我尝试使用本地 Apache (2.4.18),它会返回此错误:

[Wed Feb 28 19:19:21.079971 2018] [authz_core:debug] [pid 6892] mod_authz_core.c(809): [client 127.0.0.1:35198] AH01626: authorization result of Require all granted: granted
[Wed Feb 28 19:19:21.080019 2018] [authz_core:debug] [pid 6892] mod_authz_core.c(809): [client 127.0.0.1:35198] AH01626: authorization result of <RequireAny>: granted
[Wed Feb 28 19:19:21.080489 2018] [core:error] [pid 6892] [client 127.0.0.1:35198] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
[Wed Feb 28 19:19:21.080495 2018] [core:debug] [pid 6892] core.c(3628): [client 127.0.0.1:35198] AH00121: r->uri = /public/public/public/public/public/public/public/public/public/public/
[Wed Feb 28 19:19:21.080497 2018] [core:debug] [pid 6892] core.c(3635): [client 127.0.0.1:35198] AH00122: redirected from r->uri = /public/public/public/public/public/public/public/public/public/
[Wed Feb 28 19:19:21.080499 2018] [core:debug] [pid 6892] core.c(3635): [client 127.0.0.1:35198] AH00122: redirected from r->uri = /public/public/public/public/public/public/public/public/
[Wed Feb 28 19:19:21.080501 2018] [core:debug] [pid 6892] core.c(3635): [client 127.0.0.1:35198] AH00122: redirected from r->uri = /public/public/public/public/public/public/public/
[Wed Feb 28 19:19:21.080503 2018] [core:debug] [pid 6892] core.c(3635): [client 127.0.0.1:35198] AH00122: redirected from r->uri = /public/public/public/public/public/public/
[Wed Feb 28 19:19:21.080504 2018] [core:debug] [pid 6892] core.c(3635): [client 127.0.0.1:35198] AH00122: redirected from r->uri = /public/public/public/public/public/
[Wed Feb 28 19:19:21.080506 2018] [core:debug] [pid 6892] core.c(3635): [client 127.0.0.1:35198] AH00122: redirected from r->uri = /public/public/public/public/
[Wed Feb 28 19:19:21.080508 2018] [core:debug] [pid 6892] core.c(3635): [client 127.0.0.1:35198] AH00122: redirected from r->uri = /public/public/public/
[Wed Feb 28 19:19:21.080509 2018] [core:debug] [pid 6892] core.c(3635): [client 127.0.0.1:35198] AH00122: redirected from r->uri = /public/public/
[Wed Feb 28 19:19:21.080511 2018] [core:debug] [pid 6892] core.c(3635): [client 127.0.0.1:35198] AH00122: redirected from r->uri = /public/
[Wed Feb 28 19:19:21.080512 2018] [core:debug] [pid 6892] core.c(3635): [client 127.0.0.1:35198] AH00122: redirected from r->uri = /
[Wed Feb 28 19:19:21.134407 2018] [authz_core:debug] [pid 6894] mod_authz_core.c(809): [client 127.0.0.1:35200] AH01626: authorization result of Require all granted: granted, referer: http://laravel.local/
[Wed Feb 28 19:19:21.134426 2018] [authz_core:debug] [pid 6894] mod_authz_core.c(809): [client 127.0.0.1:35200] AH01626: authorization result of <RequireAny>: granted, referer: http://laravel.local/
[Wed Feb 28 19:19:21.134607 2018] [core:error] [pid 6894] [client 127.0.0.1:35200] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace., referer: http://laravel.local/
[Wed Feb 28 19:19:21.134612 2018] [core:debug] [pid 6894] core.c(3628): [client 127.0.0.1:35200] AH00121: r->uri = /public/public/public/public/public/public/public/public/public/public/favicon.ico, referer: http://laravel.local/
[Wed Feb 28 19:19:21.134614 2018] [core:debug] [pid 6894] core.c(3635): [client 127.0.0.1:35200] AH00122: redirected from r->uri = /public/public/public/public/public/public/public/public/public/favicon.ico, referer: http://laravel.local/
[Wed Feb 28 19:19:21.134616 2018] [core:debug] [pid 6894] core.c(3635): [client 127.0.0.1:35200] AH00122: redirected from r->uri = /public/public/public/public/public/public/public/public/favicon.ico, referer: http://laravel.local/
[Wed Feb 28 19:19:21.134618 2018] [core:debug] [pid 6894] core.c(3635): [client 127.0.0.1:35200] AH00122: redirected from r->uri = /public/public/public/public/public/public/public/favicon.ico, referer: http://laravel.local/
[Wed Feb 28 19:19:21.134619 2018] [core:debug] [pid 6894] core.c(3635): [client 127.0.0.1:35200] AH00122: redirected from r->uri = /public/public/public/public/public/public/favicon.ico, referer: http://laravel.local/
[Wed Feb 28 19:19:21.134625 2018] [core:debug] [pid 6894] core.c(3635): [client 127.0.0.1:35200] AH00122: redirected from r->uri = /public/public/public/public/public/favicon.ico, referer: http://laravel.local/
[Wed Feb 28 19:19:21.134627 2018] [core:debug] [pid 6894] core.c(3635): [client 127.0.0.1:35200] AH00122: redirected from r->uri = /public/public/public/public/favicon.ico, referer: http://laravel.local/
[Wed Feb 28 19:19:21.134629 2018] [core:debug] [pid 6894] core.c(3635): [client 127.0.0.1:35200] AH00122: redirected from r->uri = /public/public/public/favicon.ico, referer: http://laravel.local/
[Wed Feb 28 19:19:21.134630 2018] [core:debug] [pid 6894] core.c(3635): [client 127.0.0.1:35200] AH00122: redirected from r->uri = /public/public/favicon.ico, referer: http://laravel.local/
[Wed Feb 28 19:19:21.134632 2018] [core:debug] [pid 6894] core.c(3635): [client 127.0.0.1:35200] AH00122: redirected from r->uri = /public/favicon.ico, referer: http://laravel.local/
[Wed Feb 28 19:19:21.134634 2018] [core:debug] [pid 6894] core.c(3635): [client 127.0.0.1:35200] AH00122: redirected from r->uri = /favicon.ico, referer: http://laravel.local/

这是我的虚拟主机:

<VirtualHost *:80>
    ServerName laravel.local

    ServerAdmin webmaster@localhost
    DocumentRoot /home/oskar/Webapps/Laravel/twitter_follow/public
        <Directory   /home/oskar/Webapps/Laravel/twitter_follow/public>
        AllowOverride All
                Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
                <Limit GET POST PUT DELETE OPTIONS>
                        Require all granted
                </Limit>

                <LimitExcept GET POST PUT DELETE OPTIONS>
                        Require all denied
                </LimitExcept>
        </Directory>
    ErrorLog $APACHE_LOG_DIR/laravel_local.error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel debug

    CustomLog $APACHE_LOG_DIR/laravel_local.access.log combined
</VirtualHost>

这是 .htaccess 文件:

<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>

RewriteEngine On

# Handle Authorization Header
RewriteCond %HTTP:Authorization .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%HTTP:Authorization]

# Redirect Trailing Slashes If Not A Folder...
RewriteCond %REQUEST_FILENAME !-d
RewriteCond %REQUEST_URI (.+)/$
RewriteRule ^ %1 [L,R=301]

# Handle Front Controller...
RewriteCond %REQUEST_FILENAME !-d
RewriteCond %REQUEST_FILENAME !-f
RewriteRule ^ index.php [L]
</IfModule>

知道发生了什么吗?

【问题讨论】:

【参考方案1】:

你可以试试这个作为虚拟主机吗?通过查看跟踪,很可能是配置问题

<VirtualHost *:80>
  ServerName laravel.local
  DocumentRoot /home/oskar/Webapps/Laravel/twitter_follow/public

  <Directory /home/oskar/Webapps/Laravel/twitter_follow/public>
    Options Indexes FollowSymLinks
    AllowOverride all
    Require all granted
  </Directory>

  ErrorLog $APACHE_LOG_DIR/laravel-local-error.log
  CustomLog $APACHE_LOG_DIR/laravel-local-access.log combined

</VirtualHost>

【讨论】:

您好 ainmme,使用此配置我收到此错误:La página laravel.local no puede procesar esta solicitud ahora。 HTTP ERROR 500,但我在日志文件中没有任何错误。

以上是关于laravel,基本安装,重定向给我一个 500 错误的主要内容,如果未能解决你的问题,请参考以下文章

登录后 Laravel 基本身份验证重定向到 HTTPS 路由

Laravel 模态表单重定向返回,输入不起作用

Lumen + nginx = 错误 500,重写或内部重定向循环,同时内部重定向到“/index.php”

Laravel Spark - 登录时重定向

找不到基本404和500页。htaccess重定向

Laravel 基础 URL 无缘无故重定向到 /home