Answer the question
In order to leave comments, you need to log in
Incorrect mime-type from Centos+Nginx+PHP-FPM server?
We have a server on CentOS 6 on it with Nginx + PHP-FPM without Apache
. Periodically, css / js files are given with a jpg or png mime type and the user browser is very upset about this. The pattern could not be identified. Playable on different browsers and different platforms. Browser requests are quite correct. After cleaning the browser cache, as a rule, it is possible to get the file in the desired mime-type, sometimes for chrome you have to clear the cache several times.
What has been done to solve the problem:
1. All css have the following: <link type="text/css" rel="stylesheet"
2. The same for js: <script type="text/javascript"
3. In the server configs:
/etc/mime.types
text/javascript js
text/css css
image/jpeg jpg
image/png png
/etc/nginx/mime.types
types{
text/javascript js;
text/css css;
image/jpeg jpg;
image/png png;
/etc/nginx/nginx.conf
http{
include /etc/nginx/mime.types;
default_type text/html;
/etc/php.ini
default_mimetype="text/html"
Answer the question
In order to leave comments, you need to log in
The above configuration does not indicate that your static is given directly from the disk.
Is that true, or is it generated and served along with everything else by fpm ?
If, nevertheless, it is given through a separate location, you can try to make 2 locations, one giving css, the second giving jpg/png, and specify the mime type specifically for them.
did you look at the http headers from the server in chrome-dev-tools?
what do they write there?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question