Nginx won't serve any static file?

Viewed 16

I have been having problems with Nginx not wanting to serve basic css, js, jpg...

When I enter http://myapp.com/css/main_style.css I want to get the css file and when I enter http://myapp.com/js/ui.js I want to get the js file.

This time I only have the most basic config so there will be no confusion. I gave www-data permissions to access the public folder but it returns 404 when searching for a specific file. I am using standard Ubuntu for this. I have tried using Nginx as a reverse proxy for Node.Js and it works fine there it just doesn't load static files.

#doesn't work
user www-data;

http {
    server {
        # I've also tried alias
        root "/home/user/Documents/myapp.com/CURRENT PROJECT/public";
        server_name myapp.com;

        location / {
                autoindex on;
                try_files $uri $uri/ =404;
        }

    }
}
0 Answers
Related