0

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?

1
  • Yup, you have to change permissions for all storage directory recursively. If you're using 777 then sudo chmod -R 777 /path/to/laravel/storage Commented Nov 4, 2016 at 18:15

3 Answers 3

1

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.

Sign up to request clarification or add additional context in comments.

5 Comments

There seems to be no log generated, when is it generated? I set the folder permission to 775.
none there is a red flag that permissions could be the issue. Was the storage/logs directory there? I dealt with a similar issue before that I though was permissions but turned out my storage directory had been removed. Make sure your storage directory matches the default: github.com/laravel/laravel/tree/master/storage
yes, there is no laravel.log at all, directory structure is fine, the only thing in the logs folder is the gitignore... Could there something I'm missing in the overall configuration or something? Actually Laravel somehow seems to work (as described), because undefined routes throw this error, whereas existing routes (like the /login), return this error code 500...
EDIT: I tried changing the permissions for logs directory to 777, now the file got generated, as well I'm getting the errors in browser, I'll edit my question to represent those, can you have a look?
Got it, I'll answer it myself, thanks for the help!!
0

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

Comments

0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.