CSS и изображения, не распознаваемые nginx: ресурс интерпретируется как таблица стилей, но передается с MIME-типом text / html

Я пытаюсь запустить Rainloop в подкаталоге. Http: // Babylon / веб-почты. Я получаю 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".

Некоторые возможные (но не сработавшие) решения, которые я пробовал:

  1. «include /etc/nginx/mime.types;» находится в nginx.conf.
  2. Некоторые говорят, что расположение php портит эту часть, поэтому я должен добавить эту строку:

    fastcgi_split_path_info ^ (. +. php) (/.+) $; # эта строка

Но все равно это не работает.

  1. Я добавляю новые места для css и javascript с правами root, но тоже ничего.

Мой конфиг это: (это включенный файл)

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;
}
}

0

Решение

Я думаю, что это может решить вашу проблему.

location ~ \.css {
add_header  Content-Type    text/css;
}
location ~ \.js {
add_header  Content-Type    application/x-javascript;
}
2

Другие решения

Других решений пока нет …

По вопросам рекламы ammmcru@yandex.ru
Adblock
detector