Add User to www-data and Set Permission for var www

Get stuck HTTP Error 500 for your Laravel project? Use this method and let it work like a charm

Posted by Jefry Dewangga on February 19, 2017

You've developed Laravel using php artisan serve command and you want it to be served in your local server or may be you wanna deploy it to shared hosting, but you got HTTP Error 500.

It doesn't mean you've something wrong with your code, it just because the directories within storage and bootstrap/cache directories should be writable by your web server or Laravel won't run.

To solve it, run the code below on terminal, don't forget to change USERNAME with your username and let it work like a charm.

sudo adduser USERNAME www-data && sudo chown -R www-data:www-data /var/www && sudo chmod -R g+rw /var/www

The next step you must to do is, re-login to your computer or if you prefer you can restart it.


  Older Posts →