B
B
bozuriciyu2019-12-16 19:19:03
Nginx
bozuriciyu, 2019-12-16 19:19:03

Why is proxy proxy not working?

There is imgproxy - a microservice running in the docker on port 13333. I successfully proxy it with nginx.

server {
  listen 80;
  server_name imgproxy-server.loc;

  location / {
    proxy_pass http://127.0.0.1:13333;
    include proxy_params;
  }
}

According to the url like imgproxy-server.loc/image.jpg everything works ok. Directly 127.0.0.1:13333/image.jpg is also ok.
Now I'm trying to proxy this imgproxy-server.loc proxy in another nginx config, but alas, it doesn't work.
upstream imgproxy {
  server imgproxy-server.loc;
}

server {
  listen 80;
  server_name example.loc;

  location /images {
    proxy_pass http://imgproxy;
    include proxy_params;
    # proxy_pass http://127.0.0.1:13333; # работает ок
    # include proxy_params; # работает ок
  }
}

What is wrong and how to fix it? I see errors in the logs:
- failed (24: Too many open files) (subtracted that the problem is with worker_rlimit_nofile)
- worker_connections are not enough while connecting to upstream (when it was useful to play with worker_rlimit_nofile)
- failed (111: Connection refused) Could not be fixed
, and it became hard to go deeper)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
ky0, 2019-12-16
@bozuriciyu

Add to the list of names on the internal nginx example.locor reassign the header Host.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question