我正试图在子目录中运行Rainloop。http://babylon/webmail。我得到的css和js是不被识别的。例如:
Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://babylon/webmail/rainloop/v/1.10.5.192/static/css/rainloop/v/1.10.5.192/static/css/app.min.css?standard".我尝试了一些可能(但没有奏效)的解决方案:
但还是不起作用。
我的配置是这样的:(它是一个包含的文件)
location ^~ /webmail {
root /srv/rainloop/public_html;
try_files $uri $uri/ /webmail/index.php?$query_string;
access_log /srv/rainloop/logs/access.log;
error_log /srv/rainloop/logs/error.log;
index index.php;
access_log /var/log/nginx/scripts.log scripts;
location ~ \.php$ {
#if (!-f $request_filename) { return 404; }
include fastcgi_params;
#fastcgi_split_path_info ^(.+\.php)(/.+)$; #this line
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
#fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME /srv/rainloop/public_html/index.php;
}
location ~ /\.ht {
deny all;
}
location ^~ /webmail/data {
deny all;
}
}发布于 2017-08-16 14:37:46
我认为它能解决你的问题。
location ~ \.css {
add_header Content-Type text/css;
}
location ~ \.js {
add_header Content-Type application/x-javascript;
}发布于 2020-08-14 09:53:23
我在CSS和Javascript文件中遇到了同样的问题,这些文件被用作text/html。在没有任何效果的情况下,我尝试了几个小时内所能想到的一切,然后通过重新启动Chrome自动解决了这个问题。
发布于 2020-08-17 04:23:30
将下面的代码块添加到适当的位置块中:
types {
text/css css;
}https://stackoverflow.com/questions/45716128
复制相似问题