我现在正在学习 laravel。我做了一个博客演示,它在我的 mac 上与 MAMP 配合使用效果很好。
但是当我将它部署到我的远程服务器上时,它现在可以工作了!除了 500 错误,我什么也得不到!
我搜索了很多次这个问题,我重新安装了我的 vps 并获得了一个新的新 laravel 项目,但问题仍然存在。
真是郁闷啊!
我将提供我的代码和配置。
顺便说一句,这是使用 composer 首次安装 laravel 项目的结果,而不是我的博客演示
操作系统:centos 6 x64 与 php、mysql、nginx
这是我解决问题的尝试,我会提供图片,但会导致 img 无法显示声誉不足
如您所见,我 chmod & chown 文件和存储以及 Bootstrap 目录:
chmod -R 775 存储
chown -R www:www
drwxrwxr-x 5 www www 4096 May 11 20:42 storage
我将位置添加到 nginx 配置:
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
try_files $uri /index.php =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
fastcgi_pass 是对的
我已经在那里下订单了
php artisan 键:生成
php artisan缓存:清除
Composer 转储自动加载
Composer 安装
Composer 克莱尔卡
我打开了 Debug模式,但看起来 laravel 不工作包括调试功能
我检查了我的 nginx access_log,只显示了 bingbot 和 googlebot
66.249.79.148 - - [12/Jul/2017:17:00:42 +0800] "GET/view/4HGpgbSQ2s8 HTTP/1.1"404 162 "-""Mozilla/5.0(兼容;Googlebot/2.1; +http://www.google.com/bot.html)"
然后我检查了我的 website.log 它只显示 500 错误而没有任何其他消息
153.125.238.239 - - [12/Jul/2017:16:51:42 +0800] "GET / HTTP/1.1" 500 5 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36"
我打开 chrome 控制台收到一条消息
GET http://test.yiqixue.win/ 500 (Internal Server Error)
没有别的 我已经用 chmod$chown 解决了 430 permission denided 和 404 error with change the fastcgi_pass 但我被困在这里,如果你有任何想法请告诉我。
最佳答案
在某些情况下,我的服务器无法在 755 模式下工作,所以我将其更改为 777
chmod -R 777 存储
工作后,我变回755
关于php - 使用 nginx 在服务器上部署 laravel 出现 500 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45053328/