user1200387
user1200387

Reputation: 625

Nginx issue serving CSS files.

I am trying to serve all my static assets via nginx. The javascript I have is loading in fine however the css keeps coming in with Content-Type:text/plain. This is causing the browser to not use the css file. Here is my nginx.conf:

events {
    worker_connections  1024;
}

http {
    server {
        listen       80;

        location / {
            include /etc/nginx/mime.types;
            root /opt/app/public;
        }
    }
}

The include:

<link rel="stylesheet" href="/css/main.css">

Most of the stack overflow threads recommend including the mime types which I already have and it did not fix my issue. Any suggestions?

Upvotes: 0

Views: 484

Answers (1)

Exprator
Exprator

Reputation: 27533

server {
    root /www/data;

    location / {
    }

    location /images/ {
    }

    location ~ \.(mp3|mp4) {
        root /www/media;
    }
}

Upvotes: 1

Related Questions