I've seen several examples of this now: Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://localhost:3001/assets/css/bootstrap.min.css"
. But, I've not been able to understand what might be causing it.
The CSS files in my simple PHP project are not being served. The status code is 200
, and the file does load and its contents can be viewed from the developer console. I also checked the /etc/nginx/mime.types
file and it has an entry for text/css
. Finally, here's my site config:
server {
listen 3001 default_server;
listen [::]:3001 default_server;
server_name _;
location / {
root /media/common/code/projects/newdf;
try_files $uri $uri/ =404;
include fastcgi_params;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
}
}
Even in the code, the HTML tags specify the type as text/css
:
<link rel="stylesheet" type="text/css" href="<?php echo $server_url; ?>/assets/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="<?php echo $server_url; ?>/assets/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="<?php echo $server_url; ?>/assets/css/animate.css">
<link rel="stylesheet" type="text/css" href="<?php echo $server_url; ?>/assets/css/style.css">
I'm at a loss to understand what's going on.
Interestingly, JS files are loaded without error, and if I run the site on the built-in PHP server, there are no problems.