Laravel and Nginx static files Laravel and Nginx static files laravel laravel

Laravel and Nginx static files


As Kyslik hinted, this could be a permission problem.

I had a similar problem, running Laravel on Homestead on Windows 10. In my case, I could access the files from public\css directory, but not from public\css\vendor. I realized that I created the vendor directory from Windows, and as a result, the files in it were not accessible by ngingx.

To fix the issue I deleted the vendor directory and recreated it from within the vagrant box.


The urls don't need to include the /public part in the path. /public is the root for your web assets. So your url should be:

http://mywebsite.com/css/style.css


All you have to do is understanding the server is a different pc entirely and resolving path range for hosting service all around the global.

Best practice is to make sure your assets are only one step deeper into your application

Eg.

<link href="folder/bootstrap/css/bootstrap.min.css" /> wrong

<link href="bootstrap/bootstrap.min.css" /> correct

The server will not stress scanning directory. and the server will only go one step deeper.

AWS Ec2 Instance Ubuntu x Laravel Application.