user5638730
user5638730

Reputation: 545

Laravel Ubuntu 16.04 returning status code 500

I just deployed a Laravel project I developed at localhost (using XAMPP) to a server.

I uploaded all files, created a new .env file (also got an app-key), ran composer install, created the db, ran artisan migrate.

Also, in /etc/apache2/sites-enabled/000-default.conf I set the DocumentRoot to the public directory of laravel. Also I tried to edit the apache2.conf to include the directory, with Allowoverride All.

But entering the ip of my server, I get redirect to the login page (of course, I'm using the Auth of Laravel).

But I'm getting the error:

Failed to load resource: the server responded with a status of 500 (Internal Server Error)

I tried to follow those steps, but it's all the same. Except the one point, that in my apache2.conf I don't wrote the DocumentRoot anymore, as I already set it in the 000-default.conf. I also tried to set it a second time in the apache2.conf, but this changed nothing.

So what couuld the problem be?

I'm using Ubuntu 16.04.

PS: Something seems to happen inside of laravel. When I go an existing route, I always get this error code 500. When I go to a route, that doesn't exist, I get an error (NotFoundHttpException), so the Routing itself kinda seems to work, but where does this error come from? It are exactly the local files I'm using with XAMPP, and locally it works fine... Any ideas?

EDIT: After editing my logs directory to have permissions like 777, I'm getting 2 errors as well.

Both point to storage/framework/views/ and storage/framework/sessions, saying "Permission denied". Do I just have to run chmod for those directories as well?

Upvotes: 0

Views: 1030

Answers (3)

huy
huy

Reputation: 174

if you use vps ubuntu, you have to set write/read permission with root folder (and all file, folder of it) by using this command on putty:

chown -R www-data:www-data /var/www/html

i tried this command, and my website doest not show 500 error

Upvotes: 0

user5638730
user5638730

Reputation: 545

Okay, I got it, basically it was the permissions.

I now changed the owner of the storage folder to www-data. Now it's working (for anyone that might experience this problem, too).

Upvotes: 0

Eric Tucker
Eric Tucker

Reputation: 6345

Check the error in storage/logs/laravel.log if there is no log there then make sure your directory permissions for storage allows it to be writeable 775 is what I normally use.

Upvotes: 1

Related Questions