I'm using nginx 1.6.2 on Windows (development machine) and I have an issue where it will always return a text/plain
value for the Content-Type
header of any file. This is a problem because then browsers won't render CSS, compute JS, etc.
By default I had no default nginx.config file (unlike on Linux) so I had to build it from scratch while keeping it minimal. Normally my issue is solved by including etc/nginx/mime.types
so I copy/pasted that file from a CentOS server I have. But it doesn't seem to have any effect. I tried to purposedly make the include path wrong, and that triggered an error, so I think it's actually parsed correctly when I make it correct.
So I have absolutely no idea why nginx keeps returning text/plain for every single fine I have.
This is my nginx.conf file:
events {
worker_connections 1024;
}
http {
include D:/dev/nginx/mime.types;
expires off;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log D:/dev/nginx/logs/access.log main;
error_log D:/dev/nginx/logs/error.log;
upstream backend {
server localhost:62755;
}
server {
listen 80;
server_name localhost;
client_body_temp_path D:/dev/nginx/client_body_temp;
proxy_temp_path D:/dev/nginx/proxy_temp;
location / {
root D:/dev/frontend/src;
index index.html;
}
location /api {
proxy_pass http://backend;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
}
}
}