deploy laravel on server with nginx get a 500 error
In some case, my sever did not work in 755 mode so i change it to 777
chmod -R 777 storage
After working, i change back to 755
Comments
-
Evol Rof almost 2 years
I am studying laravel now.And I make a blog demo,it works great with MAMP on my mac.
But when I deploy it on my remote server,it's now work!I can't get anything but a 500 error!
I search the problem so many times ,I reinstalled my vps and get a new fresh laravel project but the problem is still here.
It's really frustrated! I will provide my code and my config. BTW this is the result from the fresh initial laravel project install with composer not my blog demo OS: centos 6 x64 with php,mysql,nginx here is my attempts to solve the problem,i will give the pics but cause the lack of reputation the img wont showas you can see I chmod & chown the files and storage and bootstrap dir :
chmod -R 775 storage
chown -R www:wwwdrwxrwxr-x 5 www www 4096 May 11 20:42 storage
I add the location to nginx config :
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; }
the fastcgi_pass is right
And I already run there orders
php artisan key:generate php artisan cache:clear composer dump-autoload composer install composer clearca
I opened the debug mode but is looks like laravel doesn't work include debug function
I had checked my nginx access_log and just shows the bingbot and googlebot66.249.79.148 - - [12/Jul/2017:17:00:42 +0800] "GET /view/4HGpgbSQ2s8 HTTP/1.1" 404 162 "-" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
then I checked my website.log it just shows the 500 error without any other message
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"
I opened chrome console got a message
GET http://test.yiqixue.win/ 500 (Internal Server Error)
nothing else I have solved 430 permission denided with chmod$chown and 404 error with change the fastcgi_pass but I am stuck here,please tell if you have any idea.
-
Antonios Tsimourtos almost 7 years1) Have you tried using
chmod -R 755 laravel
? (laravel folder not only storage) 2) can you show us your.htaccess
file? 3) Have you generated a key? (php artisan key:generate
) -
M. Eriksson almost 7 yearsEnable
display_errors
in your php.ini and see if you get any errors on the screen. You can also try to add an index.php that just contains<?= "hello world"
to see if there are something else going on.
-
-
Nik K over 5 yearsI noticed a caching issue in Chrome. When I opened in Firefox, Opera or Safari, it worked. Chrome needed the cookies deleted once the permissions where changed. It's worth noting I wasn't testing on HTTPS and the login form was warning as insecure.
-
Ryan Ellis about 5 yearsThanks @NikK - Freaking caching issue! I'm like ... I rolled back ALL my nginx configs ... WHY IS THERE STILL A 500?! CACHING!! <3 you!