By Shaney
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!
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!
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
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.