eldragonmanuel's avatar

not found assets laravel vite

install my laravel 10.10 project on an aws ec2 instance

run npm install everything correct

run npm build everything correct

The files were generated in

/public/build/assets/app-6e0eadfb.js /public/build/assets/app-1766b808.css

When I navigate to those files it indicates that they do not exist

in app.blade.php is the code

@vite(['resources/css/app.css', 'resources/js/app.js'])

Any recommendation?

0 likes
4 replies
eldragonmanuel's avatar

@vincent15000

It is a production environment

I made a file a.php with phpinfo() in /public/build/assets/ folder

When I enter the file from the browser it runs correctly

When I see the app-1766b808.css file from the browser it returns a 404 error although the file exists

2 likes
eldragonmanuel's avatar

I was able to correct the problem, the nginix server did not have CSS and JS reading enabled

use the configuration:

location ~ .css { add_header Content-Type text/css; } location ~ .js { add_header Content-Type application/x-javascript; }

2 likes

Please or to participate in this conversation.