title: Wrong mime type Nginx for all images
body: <p>We have a strange problem with Nginx. In Chrome the application, the images does not work. It gives an 404 for images. Css do load. When clicking on the image url it opens. The problem is that tha webserver gives mime type: <code>Content-Type: text/html</code>. The CSS files do get the correct mime type. </p>
  
  <p>In nginx.conf the mime types are loaded with all image mime types in it: </p>
  
  <pre><code>http {
  log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                    '$status $body_bytes_sent "$http_referer" '
                    '"$http_user_agent" "$http_x_forwarded_for"';
  
  access_log  /var/log/nginx/access.log  main;
  
  sendfile            on;
  tcp_nopush          on;
  tcp_nodelay         on;
  keepalive_timeout   65;
  types_hash_max_size 2048;
  
  include             /etc/nginx/mime.types;
  </code></pre>
  
  <p>We created an custom conf file with additional rules: </p>
  
  <pre><code>server {
  
          listen 80;
  
          server_name acceptatie.portal.***.com *.portal.***.com;
  
          root /home/fsweb/www/portal;
  
          index index.html index.php;
  
          access_log /var/log/nginx/portal.***.com.access.log;
          error_log /var/log/nginx/portal.***.com.error.log error;
  
          location ~ /\.git {
            deny all;
          }
  
          location ~ /\. {
            deny all;
          }
  
          location ~ (\.md$|myadmin) {
              deny all;
          }
  
          location / {
                  try_files $uri $uri/ /index.php?$query_string;
          }
  
          server_tokens off;
  
          location ~ \.php$ {
                  #include snippets/fastcgi-php.conf;
                  fastcgi_pass 127.0.0.1:9000;
                  fastcgi_split_path_info ^(.+\.php)(/.+)$;
                  #fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
                  fastcgi_index index.php;
                  include fastcgi_params;
                  fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                  fastcgi_intercept_errors on;
                  fastcgi_buffer_size 16k;
                  fastcgi_buffers 4 16k;
                  fastcgi_connect_timeout 300;
                  fastcgi_send_timeout 300;
                  fastcgi_read_timeout 300;
          }
  
          add_header x-xss-protection "1; mode=block" always;
          add_header x-frame-options "SAMEORIGIN" always;
          add_header X-Content-Type-Options "nosniff" always;
  
  }
  </code></pre>
  
  <p>It works for all files except the image files. I already tried to import the mime files in my custom conf file in different positions but it keeps giving text/html. Chrome blocks the images and Firefox ignores this problem. </p>
  
  <p>Did i do something wrong? </p>
  
  <p>--- UPDATE ---</p>
  
  <p>I have tried via curl -i. The response is right: </p>
  
  <pre><code>HTTP/1.1 200 OK
  Date: Tue, 26 Mar 2019 09:55:23 GMT
  Content-Type: image/png
  Content-Length: 6229
  Last-Modified: Wed, 27 Jun 2018 07:24:21 GMT
  Connection: keep-alive
  ETag: "5b333ba5-1855"
  x-xss-protection: 1; mode=block
  x-frame-options: SAMEORIGIN
  X-Content-Type-Options: nosniff
  Accept-Ranges: bytes
  </code></pre>
  
  <p>But when using Chrome the response is wrong:</p>
  
  <pre><code>Connection: Close
  Content-Type: text/html
  </code></pre>