Question

Laravel / Document root : getting a blank page

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…

Thanks!

Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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.

NGINX

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

APACHE

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