develdevil
develdevil

Reputation: 327

CakePHP 3 on nginx not loading css and js files

I am trying to configure CakePHP 3 on OSX running nginx. The default page reports that everything is working except URL rewriting. However, I have URL rewriting working for page URLs (just followed the instructions for nginx setup). The only thing that's not working is loading static assets from webroot. I've been digging through a ton of similar stackoverflow questions and none of the responses seem to work.

vhost file:

server {
    listen       80;
    server_name  albums.dev;
    root       /Users/username/Sites/albums;

    access_log  /Library/Logs/default.access.log  main;

    location / {
        try_files $uri $uri/ /index.php?$args;
    }  

    location ~ \.php$ {
        include   /usr/local/etc/nginx/conf.d/php-fpm;
    }
}

Again: The entire CakePHP application seems to be working correctly, except the static assets in /webroot/ are coming up as 404.

Upvotes: 0

Views: 1266

Answers (1)

Mohammad Niknab
Mohammad Niknab

Reputation: 34

change the root .. you must point to webroot of your project

if you want i can give my conf to you

Upvotes: 1

Related Questions