【问题标题】:Laravel 5 geting 500 error in hostingLaravel 5 在托管时出现 500 错误
【发布时间】:2016-05-24 05:28:43
【问题描述】:

我花了一个晚上在主机上运行我的 laravel 应用程序。

在 mac os 上的 localhost 中一切正常,但在 ubuntu 上托管时出现 500 错误。

我没有任何线索。

.htaccess 在根目录

Options -Indexes

<IfModule mod_rewrite.c>
  RewriteEngine on

  RewriteCond %{REQUEST_URI} !^public
  RewriteRule ^(.*)$ public/$1 [L]
</IfModule>

# Deny accessing below extensions
<Files ~ "(\.json|\.lock|\.git)">
Order allow,deny
Deny from all
</Files>

# Deny accessing dot files
RewriteRule (^\.|/\.) - [F]

和公开的.htaccess

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

RewriteEngine On

# Redirect Trailing Slashes...
RewriteBase /
RewriteRule ^(.*)/$ /$1 [L,R=301]

# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

如果我删除 /public/.htaccess 我会得到server error 500

否则我会得到Server error The website encountered an error while retrieving http://oboi.spb.ru/. It may be down for maintenance or configured incorrectly.

【问题讨论】:

  • 您无法将 Apache 的 DocumentRoot 设置为服务器上的public 目录吗?
  • 你得到 laravel 的 500 错误吗?你能启用调试并显示错误吗?
  • 查看文件夹权限(存储、日志)storage文件夹应该有app、framework、logs和bootstrap/cache
  • @Bogdan,我无法在 tis 托管中使用 DocumentRoot,另一个站点工作正常
  • @EduardoPacios,我得到 laravel 的 500 错误。 storege/logs/laravel.log 没有机会

标签: php .htaccess laravel laravel-5


【解决方案1】:

条件:

  RewriteCond %{REQUEST_URI} !^public

失败是因为您在 Cond 模式中的 public 之前缺少 /,因此规则被应用于每个请求,导致无限递归。

将 Cond 模式更改为

!^/public

【讨论】:

    猜你喜欢
    • 2018-08-04
    • 1970-01-01
    • 2012-04-14
    • 2016-07-30
    • 2017-05-05
    • 2023-03-09
    • 2023-01-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多