I have a Nginx that runs behind docker.
Here's my .conf file
events {
worker_connections 2048;
}
http {
default_type application/octet-stream;
server {
listen 80;
index index.php index.html;
root /var/www/public;
location / {
try_files $uri /index.php?$args;
}
location ~ \.css {
include /etc/nginx/mime.types;
add_header Content-Type text/css;
}
location ~ \.js {
add_header Content-Type application/x-javascript;
}
location ~ ^/(assets/|css/|js/|index.html) {
root /var/www/public;
index index.html;
access_log off;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass app:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}
}
I've followed the solution here: Nginx fails to load css files
I also have tried the following:
- Put include /etc/nginx/mime.types; under http {
I've checked mime.types that it has the correct value as follows:
text/css css;
The result that i am getting from Chrome dev console is this:
Accept-Ranges: bytes
Content-Length: 52806
Content-Type: text/plain
Content-Type: text/css
Date: Thu, 20 Sep 2018 09:49:35 GMT
ETag: "5ba0bfef-ce46"
For some reason, Nginx loads it as text/plain and text/css altogether.
This is the Nginx version that I am using:
Server: nginx/1.15.3
EDIT
Interestingly enough, if i do curl -v like this, it is being treated as text/css
Can anyone point me in the right direction? Thanks