Laravel / Document root : getting a blank page

Posted March 23, 2015 20.7k views
NginxPHP Frameworks

I’m running Ubuntu 14.04 x64 and nginx

I had a basic laravel project working. The following line in the server {} block of my /etc/nginx/sites-available/default file worked to get it to load in the browser at my IP address.

root /usr/share/nginx/html/laravel/public;

I made a new project, again Laraval 5 with only some basic CSS and a template added and I cloned it to /usr/share/nginx/html/new and I changed the document root line to

root /usr/share/nginx/html/new/public;

It doesn’t work. The file structure is exactly the same as the original laravel directory so I don’t understand why. I changed the document root back to the original directory, restarted nginx and the original site worked again. I deleted the original directory, renamed the ‘new’ one to 'laravel’ but that doesn’t work either. The directory structure now is the same as it was originally. The laravel project works locally on my home computer so I don’t think the problem is broken code or anything like that.

Can anyone advise? I forget if I had to do anything special setting up the original project and I’m new to nginx and all this stuff…


  • If you turn on debugging with laravel, will it at least generate an error of some sort? What i’ve found with Laravel is I always have to set the permissions to the app/storage (laravel 4) manually. I am assuming you did that already?

    Try hosting it like php artisan serve –host

    This will open it up public so you can access it via IP:8000 just for testing purposes. Not recommended to keep enabled, obviously!

  • Thanks for that and sorry for the lack of appreciation! I reset the whole thing in the end. I’ll probably run into this issue again when I’ve got my head around connecting to mysql…

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

This is a fairly common issue with some Laravel installations, actually. It just means that you need to fix the directory permissions for the Laravel cache and storage directories so the webserver can access them.


First, find out what user NGINX is running as by checking in the www config file:
/etc/php/7.0/php-fpm.d/www.conf (obv replace the php version with the one applicable to your environment)

Then execute the following commands from your Laravel root directory (replace “[USER]” with the username from above.

sudo chown -R [USER]:www-data storage bootstrap/cache
sudo chmod -R ug+rwx storage bootstrap/cache


Execute the following commands from your Laravel root directory.

sudo chgrp -R www-data storage bootstrap/cache
sudo chmod -R ug+rwx storage bootstrap/cache