N
N
Nikita Nazarov2015-05-04 11:30:07
Nginx
Nikita Nazarov, 2015-05-04 11:30:07

Why can't my css be rendered through nginx on the page?

Good afternoon, I decided to deal with nginx and stopped at the fact that when you run a web page through nginx, the browser does not want to render css. When switching to the URI of the style file, it loads without problems. Here is my experimental config:

events {
    worker_connections  1024;
}

http {
    server {
        listen       80;
        server_name  localhost;
        root   ../../public/;
        error_page 404 /404.html;

        location / {
            index  /appProxy/index.html; 
        }

        location /panda/ {
            index  /panda/index.html;
        }
    }
}

I would also like to hear a couple of tips on where to start learning nginx.
Thanks in advance! :)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
SimWhite, 2015-05-04
@Noz01

Because you need to enable the definition of mime types in the server settings:

include       /etc/nginx/mime.types;
default_type  application/octet-stream;

Or something like:
location ~ \.css {
    add_header  Content-Type    text/css;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question