Nginx is not serving static files from a remote server when using proxy_pass

1

I have two servers: one is hosting a website and some dynamic content, and another one running a some small services but also (supposed to be) acting as a file host due to the larger disk space. No website needed for the files, I just have to be able to browse the file directory to locate the ones I need. This server is privately networked to the outside-facing server and the connections (public <=> external <=> internal) are working fine.

What I'm trying to do is proxy_pass the files location to the internal server. The config on the external server has this:

  location /files/ {
  proxy_pass http://10.10.10.3:80/files/;
  autoindex on;
  autoindex_exact_size off;
  }

  location /files/<redacted>/ {
  proxy_pass http://10.10.10.3:80/files/<redacted>/;
  auth_basic on;
  autoindex on;
  autoindex_exact_size off;
  }

While the internal server has this:

server {
  server_name my.domain;
  root /var/www/html/mydomain/;
  autoindex on;

  location /files/ {
  autoindex on;
  autoindex_exact_size off;
  }

  location /files/<redacted>/ {
  autoindex on;
  autoindex_exact_size off;
  }

}

I know the two are talking and the proxy is working because the internal server is showing activity in the logs, which brings me to my problem: The internal server is giving a 404 instead of showing me the /files/ directory. The error log shows this:

2019/03/08 21:55:02 [error] 19252#19252: *30 "/var/www/html/mydomain/files/index.html" is not found (2: No such file or directory), client: 10.10.10.7, server: mydomain, request: "GET /files/ HTTP/1.1", host: "mydomain"

I don't understand why it is looking for an index file! My understanding is that autoindex on; is supposed to preclude that. How do I get around this and get it to show me my files?

Jason D.

Posted 2019-03-09T12:24:54.487

Reputation: 11

No answers