无法在 NGINX 中加载 MIME 类型和图像

无法在 NGINX 中加载 MIME 类型和图像

我正在尝试加载下面详述的静态文件。index.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)$ {

           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 或图像或 json 等的是此位置块:

location ^~ /site/client/ 

其他文件类型的位置位于以下目录中:

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

我收到的错误是:

nginx 错误日志:

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/"

我检查了所有权限并且全部正确。

这些信息是否足以提出修复建议?

相关内容