簡體   English   中英

Laravel 5在托管中出現500錯誤

[英]Laravel 5 geting 500 error in hosting

我花了一整晚時間來在托管環境中運行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. Server error The website encountered an error while retrieving http://oboi.spb.ru/. It may be down for maintenance or configured incorrectly.

條件 :

  RewriteCond %{REQUEST_URI} !^public

之所以失敗,是因為您在Cond模式中缺少在公眾面前的/ ,因此該規則被應用到每個請求上,從而導致無限遞歸。

將條件模式更改為

!^/public

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM