Info
Content

Проксирование контейнера docker

Конфиг:

server {
  listen 443    ssl;
  server_name   vandud.ru www.vandud.ru;

  location / {
    proxy_pass http://bookstack;
    proxy_redirect     off;
    proxy_set_header   Host $host;
    proxy_set_header   X-Real-IP $remote_addr;
    proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header   X-Forwarded-Host $server_name;
  }
  ssl_certificate       /etc/nginx/conf.d/cert/vandud.ru.chain.crt;
  ssl_certificate_key   /etc/nginx/conf.d/cert/vandud.ru.key;
}

Подробнее о location

location / {
  proxy_pass http://bookstack;
  proxy_redirect     off;
  proxy_set_header   Host $host;
  proxy_set_header   X-Real-IP $remote_addr;
  proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_set_header   X-Forwarded-Host $server_name;
}
  • proxy_pass http://bookstack; - имя контейнера
  • Просто важные заголовки без который проксирование работает ... (но не работает)
    proxy_redirect     off;
    proxy_set_header   Host $host;
    proxy_set_header   X-Real-IP $remote_addr;
    proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header   X-Forwarded-Host $server_name;
    
No Comments
Back to top