nginx неправильно обслуживать локальные файлы c - PullRequest
0 голосов
/ 26 января 2020

У меня есть файл конфигурации nginx и каталог c stati

resolver 10.43.0.10  valid=13s;

log_format tt_nginx_logformat '$remote_addr - $http_x_forwarded_for [$time_local] "$request" $status'
  ' $request_length $bytes_sent "$http_referer" "$http_user_agent" $request_time';

log_format tt_req_body '"$request" $status $request_body';

#Sets condition for response status
map $status $loggable {
  ~^[23]  0;
  default 1;
}

server {

    access_log /dev/stderr tt_req_body if=$loggable;

    access_log  /dev/stdout tt_nginx_logformat;

    listen       80;
    server_name  localhost;

    merge_slashes on;
    client_body_timeout 10s;
    client_header_timeout 10s;
    client_max_body_size 6m;
    send_timeout 5;

    server_tokens off;
    rewrite ^/dashboard /index.html break;

    location / {
      gzip on;
      gzip_vary on;
      gzip_min_length 8192;
      gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml application/javascript;
      gzip_disable "MSIE [1-6]\.";

      #other security headers
      add_header x-xss-protection "1; mode=block" always;
      add_header x-frame-options "SAMEORIGIN" always;
      add_header X-Content-Type-Options "nosniff" always;

      root   /usr/share/nginx/html;
      index  index.html index.htm;
    }
}

, когда я получаю URL-адрес типа http://localhost/static/js

nginx попробуйте найти в локации / usr / share / nginx / html / static / js / static / js вместо / use / share / nginx / html / static / js

...