when i open my website, i get the error
The stylesheet https://skie.lol/styles.css was not loaded because its MIME type, “text/plain”, is not “text/css”.
whenever i try and log onto the website my CSS is not rendered, but the HTML is.
i’m running nginx with the nginx.conf file of
user www-data;
worker_processes auto;
pid /run/nginx.pid;
error_log /var/log/nginx/error.log;
include /etc/nginx/modules-enabled/*.conf;
events{}
http {
include mime.types;
include /etc/nginx/conf.d/*.conf/;
server{
default_type text/css;
location / {
root /home/git/website-work/www;
}
location /images/ {
root /home/git/website-work;
}
location /lexi/ {
root /home/git/website-work;
}
location /lexi {
root /home/git/website-work;
}
location /links/ {
root /home/git/website-work;
}
location /links {
root /home/git/website-work;
}
location /quotebook/ {
root /home/git/website-work;
}
location /quotebook {
root /home/git/website-work;
}
location /wip/ {
root /home/git/website-work;
}
location /wip {
root /home/git/website-work;
}
}
}
also, this is my link in HTML, as i was initially having struggles with this before i realized there was an issue with the MIME type.
<link rel="stylesheet" type="text/css" href="styles.css">
and my mime.types file at /etc/nginx/mime.types has both
text/css css;
text/plain txt;
in it. im so lost for why this doesn’t work, i just need help
ive tried:
- changing my built in linux mime.types, but it had both text/css and text/plain set correctly
- adding css and txt to both my built in linux and mime.types file, both error-ed out
- added default_type for mime types into my nginx.conf at http, server, and location level, none did anything
- setting a specific types “type{text/css css;}” to both server and location. surprisingly it did nothing, which makes me think it didnt work. so that might be able to help if theres a reason that wouldn’t work
- restarting my server, nginx and web browser multiple times, which has done nothing sadly
im still very new to linux and nginx so if i’ve made a dumb mistake, i apologize a million times
any help is appreciated, thank you
Skiee is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.