Evol Rof
Evol Rof

Reputation: 2802

deploy laravel on server with nginx get a 500 error

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 show

as you can see I chmod & chown the files and storage and bootstrap dir : screen
chmod -R 775 storage
chown -R www:www

drwxrwxr-x  5 www www   4096 May 11 20:42 storage

I add the location to nginx config : screen

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 googlebot

66.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.

Upvotes: 3

Views: 17178

Answers (3)

Abdallah Abdel Aziz
Abdallah Abdel Aziz

Reputation: 676

php artisan storage:link worked for me

Upvotes: 0

Evol Rof
Evol Rof

Reputation: 2802

I reinstalled centos and lnmp again,git clone the code.Run composer install,it shows an error that a rich text editor needs to trun on fileinfo function in php.ini,which I already uncommneted in php.ini.So I edit the composer.json remove it.It works!Even though I have no idea what I have done

Upvotes: 0

Vu Hoang Duc
Vu Hoang Duc

Reputation: 312

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

Upvotes: 12

Related Questions