
昨天配置 Nginx+gunicorn+flask 环境,配置 nginx 之前测试是可以正常显示的,一加了 nginx 之后 chrome 就显示Resource interpreted as Stylesheet but transferred with MIME type text/plain,之后试过在 nginx.conf 中加入include mime.types;和add_header content-type text/css;都没用,后面只能把!DOCTYPE html去掉勉强解决。但是还是想不明白,到底是哪里导致 CSS 的类型出错的?请各位指教
引用 CSS 的语句类似这样:
<link href="/static/easyui/themes/metro/easyui.css" rel="stylesheet" type="text/css">
nginx 配置文件如下(因为非 root 用户运行,所以由 iptables 再转成 80 端口):
include /usr/local/nginx/conf/mime.types; default_type application/octet-stream; server { listen 8080; server_name localhost; access_log /home/ubuntu/nginx/access.log; error_log /home/ubuntu/nginx/error.log; location / { proxy_pass http://localhost:8000/; proxy_redirect off; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } } 1 ebingtel 2019-03-24 19:05:52 +08:00 proxy_pass http://localhost:8000/; 把末尾的 /去掉试试? |
3 paloalto 2019-03-25 09:12:45 +08:00 via iPhone ngnix 里配置 MIME TYPES |
4 paloalto 2019-03-25 09:14:25 +08:00 via iPhone |