Невозможно загрузить mime.types в nginx - PullRequest
0 голосов
/ 04 февраля 2020

Я пытаюсь загрузить файлы c, как описано ниже. Индекс. html загружает, но все другое содержимое, например. json,. css и .jpg файлы не загружаются.

Вот мой конфиг:

       server {
      listen 80 default_server;
      return 301 https://$host$request_uri;
      #oot /var/www/site/public/client/;
      server_name  site.mydomain.net;
      return 444;
    }

    server {
      listen 443 ssl http2 default_server;
      server_name _;
      index index.html index.php;

      # standard includes
      include conf.d/directive-only/ssl.conf;
      include conf.d/basic.conf;

      location ^~ /site/client/ {
    alias /var/www/site/public/client/;
    include conf.d/services/php7.conf;
    #index        index.html;

    location ~* ^.+/\.(?:css|js|json|txt)$ {
    try_files $uri *.json
           expires 1y;
           access_log off;
           add_header Cache-Control "public";

        }

      #rss feeds and atom
    location ~* \.(?:rss|atom)$ {
       expires 1h;
       add_header Cache-Control "public";
    }

    # Media: images, icons, video, audio, HTC
    location ~* ^.+/\.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ {
       expires 1M;
       access_log off;
       add_header Cache-Control "public";
    }
    }

  location  /site/ {
    alias /var/www/site/public/;

    fastcgi_index        index.php;
    fastcgi_param        SCRIPT_FILENAME    /var/www/site/public/index.php;

  }

    # misc standard nginx configs
      location = /basic_status {
        stub_status on;
        access_log off;
        include conf.d/whitelists/internal.conf;
        deny all;
      }

      location ~ index\.html$ {
          etag off;
          add_header "Cache-Control" "max-age=0, no-cache, no-store, must-revalidate";
          add_header "Pragma" "no-cache";
          add_header "Expires" "Wed, 11 Jan 1984 05:00:00 GMT";
      }

    location ~ /\. {
          access_log off;
          log_not_found off;
          deny all;
      }
    }

Тот, который не загружает дополнительные mime.types или images или json et c, является этим блоком местоположения:

location ^~ /site/client/ 

Местоположение других типов файлов находится в следующем каталоге:

/var/www/site/public/client/assets

Я получаю следующие ошибки:

nginx errorlog:

2020/02/04 21:47:18 [error] 6#6: *179 open() "/etc/nginx/html/client/assets/images/james.png" failed (2: No such file or directory), client: 192.168.0.9, server: site.mydomain.net, request: "GET /client/assets/images/james.png HTTP/1.0", host: "site.mydomain.net", referrer: "https://site.mydomain.net/james/client/"

Я проверил все разрешения и все правильно.

Достаточно ли этой информации, чтобы внести предложение по исправлению?

...