移到服务器后Laravel 5内部服务器错误
问题描述:
我的laravel 5项目在localhost上运行良好。将项目移动到服务器后,显示内部服务器错误。移到服务器后Laravel 5内部服务器错误
错误消息
The server encountered an internal error or misconfiguration and was unable to complete your request.
我检查的要求。所有要求都是正确的。
PHP = 5.5
Mcrypt PHP Extension = Enabled
OpenSSL PHP Extension = Enabled
Mbstring PHP Extension = Enabled
Tokenizer PHP Extension = Enabled
两个的.htaccess根和公用文件夹文件是相同的,
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule^index.php [L]
</IfModule>
我测试通过删除这两个文件.htaccess
,但它仍然显示内部服务器错误。
我该如何解决这个问题?有什么建议么 ?
答
检查是否启用了mod_negotiation。我刚刚有同样的问题
答
我在迁移共享服务器时遇到同样的问题。对我有用的解决方案如下。
假设有laravel文件夹叫做test
其中包含laravel的文件夹结构。
我有使用2个不同的.htaccess文件
1)一个在(安装)laravel,即根文件夹随着与如下内容test
文件夹。
RewriteEngine On
RewriteCond %{REQUEST_URI} !^test/public
RewriteRule ^(.*)$ test/public/$1 [L]
2)公共文件夹中的一个,即内部test/public,内容如下。
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule^index.php [L]
它为我工作。
检查服务器日志,看看错误实际是什么...... – Laurence 2015-04-01 06:34:17
检查'index.php'文件的权限,我的意思是将其设置为755或777 – manix 2015-04-01 07:20:57
和......记得将'777'设置为'storage/'文件夹也是 – manix 2015-04-01 07:21:55