标签: bad-gateway

使用Traefik的Docker Swarm Windows Worker返回Gateway Timeout

目标是使用Linux服务器和运行Docker For Windows的Windows 10计算机运行混合OS Docker swarm

目前,只要将--endpoint-mode标志设置为'dnsrr',Windows工作者理论上就支持混合操作系统群.这在这里解释.然而,尝试使用traefik路由到简单的码头工人图像stefanscherer/whoami图像失败.

最小失败的例子

// On (Linux) Manager Node:
docker swarm init --advertise-addr <hostaddress> --listen-addr <hostaddress>:2377

// On (Windows 10) Worker Node:
docker swarm join <jointoken>

// On Manager Node:
docker network create --driver=overlay traefik-net

docker service create \
    --name traefik \
    --constraint=node.role==manager \
    --publish 80:80 --publish 8080:8080 \
    --mount type=bind,source=/var/run/docker.sock,target=/var/run/docker.sock \
    --network traefik-net \
    traefik \
    --docker \
    --docker.swarmmode \
    --docker.domain=traefik \
    --docker.watch \
    --web

docker service create \
    --name whoami …
Run Code Online (Sandbox Code Playgroud)

tcp-ip docker docker-swarm bad-gateway traefik

29
推荐指数
1
解决办法
1272
查看次数

Traefik>某些容器的"Bad gateway"(错误502)

我遇到了一些使用traefik和docker的问题,我不知道为什么.

对于某些容器,它就像魅力和其他容器一样,当我尝试访问这些容器时出错:错误的网关(错误502).

这是我的traefik.toml:

# Service logs (here debug mode)
debug = true
logLevel = "DEBUG"

defaultEntryPoints = ["http", "https"]

# Access log
filePath = "/var/log/traefik/access.log"
format = "common"

################################################################
# Web configuration backend
################################################################
[web]
address = ":8080"

################################################################
# Entry-points configuration
################################################################
[entryPoints]
  [entryPoints.http]
    address = ":80"
    [entryPoints.http.redirect]
      entryPoint = "https"
  [entryPoints.https]
    address = ":443"
    [entryPoints.https.tls]

################################################################
# Docker configuration backend
################################################################
[docker]
domain = "domain.tld"
watch = true
exposedbydefault = false
endpoint = "unix:///var/run/docker.sock"

################################################################
# Let's encrypt …
Run Code Online (Sandbox Code Playgroud)

docker bad-gateway traefik

9
推荐指数
1
解决办法
1万
查看次数

apt安装失败时如何强制重试?APT::Acquire::重试似乎不起作用

我正在使用一个镜像规范存储的企业存储库。我怀疑这个公司存储库不可靠,因为我有零星的故障,例如:

Failed to fetch ...  502  Bad Gateway [IP: ...]
Failed to fetch ...  404  Not Found [IP: ...]
Run Code Online (Sandbox Code Playgroud)

它似乎不依赖于要安装的包。考虑到这一点,我尝试使用APT::Acquire::Retries

RUN echo 'APT::Acquire::Retries "3";' > /etc/apt/apt.conf.d/80-retries
Run Code Online (Sandbox Code Playgroud)

(是的,我正在构建一个 docker 镜像)

以下是我安装软件包的方法:

...
    && apt install --no-install-recommends -y \
        curl \
        apt-utils \
        iputils-ping \
        nano \
        gridsite-clients\ 
...
Run Code Online (Sandbox Code Playgroud)

我感觉APT::Acquire::Retries没有考虑到(即使用更高的值,例如 30 ...)。

使用的基础镜像是 ubuntu:20.04,apt 版本等于 apt 2.0.8 (amd64)。

有什么线索吗?

[已编辑] 通过激活 apt.conf 上的以下调整,我设法摆脱了 502 错误:

RUN echo '\
Acquire::Retries "100";\
Acquire::https::Timeout "240";\
Acquire::http::Timeout "240";\
APT::Get::Assume-Yes "true";\ …
Run Code Online (Sandbox Code Playgroud)

ubuntu apt http-status-code-404 docker bad-gateway

9
推荐指数
0
解决办法
2249
查看次数

Traefik 错误网关

我有一些奇怪的问题。我有以下设置:一个 docker-host 运行 traefik 作为 LB,为多个站点提供服务。网站大多是 php/apache。HTTPS 由 traefik 管理。每个站点都使用包含以下内容的 docker-compose YAML 启动:

version: '2.3'
services:
  redis:
    image: redis:alpine
    container_name: ${PROJECT}-redis
    networks:
      - internal
  php:
    image: registry.gitlab.com/OUR_NAMESPACE/docker/php:${PHP_IMAGE_TAG}
    environment:
      - APACHE_DOCUMENT_ROOT=${APACHE_DOCUMENT_ROOT}
    container_name: ${PROJECT}-php-fpm
    volumes:
       - ${PROJECT_PATH}:/var/www/html:cached
       - .docker/php/php-ini-overrides.ini:/usr/local/etc/php/conf.d/99-overrides.ini
    ports:
      - 80
    networks:
      - proxy
      - internal
    labels:
      - traefik.enable=true
      - traefik.port=80
      - traefik.frontend.headers.SSLRedirect=false
      - traefik.frontend.rule=Host:${PROJECT}
      - "traefik.docker.network=proxy"

networks:
  proxy:
    external:
      name: proxy
  internal:
Run Code Online (Sandbox Code Playgroud)

(作为 PHP,我们使用 5.6.33-apache-jessie 或 7.1.12-apache fe)

除了上述之外,一些网站还获得以下标签:

traefik.docker.network=proxy
traefik.enable=true
traefik.frontend.headers.SSLRedirect=true
traefik.frontend.rule=Host:example.com, www.example.com
traefik.port=80
traefik.protocol=http
Run Code Online (Sandbox Code Playgroud)

我们得到的是一些请求以 502 Bad Gateway …

load-balancing docker bad-gateway traefik

8
推荐指数
4
解决办法
3万
查看次数

New Laravel(Homestead)安装:502 Bad Gateway - *Refresh* - 网站显示正确

我试图建立一个当地的Laravel项目.所以我决定使用Homestead vagrant box.在我安装了本教程中的所有内容后,我期待在浏览器中看到结果:

第一次出现的是nginx 502 Bad Gateway Error.所以我试着改写它,然后显示默认的Laravel起始页面.然后我做了一些路线和链接到我的网站的一些子页面,每次我更改我的页面(通过链接或键入获取请求)我得到"502坏网关",刷新网站后消失.

我试过了:

  • 更改php版本(如此处)
  • 使缓冲区更大(像这里)
  • 完全重新安装了我的流浪汉和VirtualBox
  • 使用其他浏览器
  • 使用我的同事的功能盒

可悲的是,没有什么能够不显示我有时"502 Bad Gateway".但是在我的同事(也是Windows 10)的PC上,所有的东西都是你所期望的.

站点的日志文件(/ var/log/nginx):

2019/01/23 20:23:53 [error] 2532#2532: *1 recv() failed (104: Connection 
reset by peer) while reading response header from upstream, client: 
192.168.10.1, server: eatthis.test, request: "GET / HTTP/1.1", upstream: 
"fastcgi://unix:/var/run/php/php7.3-fpm.sock:", host: "eatthis.test"

2019/01/23 20:24:03 [error] 2532#2532: *1 recv() failed (104: Connection 
reset by peer) while reading response header from upstream, client: 
192.168.10.1, server: eatthis.test, request: "GET …
Run Code Online (Sandbox Code Playgroud)

php nginx vagrant laravel bad-gateway

8
推荐指数
2
解决办法
1336
查看次数

“502 bad gateway” - 从 AWS Lambda 到 Application Load Balancer 的 1MB 限制静态页面

当访问由 Lambda 提供服务的 ALB 上托管的静态网页时,我们收到 502 bad gateway 错误。在 ALB 日志中,我们可以看到错误是我们的 Lambda 响应大于 1MB。我们想继续为我们的网页使用应用程序负载均衡器,并且需要找到一些方法来解决这个 1MB 限制(我们可以部署我们的代码,以便 Lambda 返回多个单独的 <1MB JS 代码块吗?)

我们在网上查看了其他 SO 问题,发现只有几个人遇到了我们的问题,但没有提供解决方案。AWS 文档记录了此限制,但同样没有提供任何解决方案。

javascript amazon-web-services node.js aws-lambda bad-gateway

8
推荐指数
1
解决办法
1599
查看次数

在 AWSEB 命令行上部署 django 应用程序时如何修复 502 Bad Gateway NGINX 错误?

我一直在尝试在awsebcli. 我立即输入eb打开命令,我的网络浏览器返回502 Bad Gateway NGINX错误。请我需要有关如何修复此错误的帮助,为了更好地查看和理解我的代码,屏幕截图位于上传链接中,如下所示。

settings.py

1

502 Bad Gateway

2

.elasticbeanstalk/config.yml

3

.ebextensions\django.config

4

aswebcli status

5

pip freeze命令结果

6

我期待您的友好回复。谢谢

python django amazon-elastic-beanstalk bad-gateway

8
推荐指数
1
解决办法
8434
查看次数

nginx 502 559 错误代码是什么意思?

我的 nginx 错误日志中收到“502 559”错误。我知道 502 的意思是“坏网关”。559是什么意思?

nginx bad-gateway

7
推荐指数
1
解决办法
5301
查看次数

CentOS上的502坏网关mvc核心应用程序

我在MVC Core上创建了一个网站,并试图在CentOS 7 VPS上将其发布到网上.它运行良好,当我卷曲它响应.然后我安装了nginx并在我的计算机上尝试时显示了默认页面.然后我将nginx.conf更改为下面的一个,我得到的是502坏网关.在nginx日志中,我只看到收到了get请求.任何想法我应该检查什么?

user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

# Load dynamic modules. See /usr/share/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;

events {
    worker_connections 1024;
}

http {
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';
    access_log  /var/log/nginx/access.log  main;

    sendfile            on;
    tcp_nopush          on;
    tcp_nodelay         on;
    keepalive_timeout   65;
    types_hash_max_size 2048;

    include             /etc/nginx/mime.types;
    default_type        application/octet-stream;

    # Load modular configuration files from the /etc/nginx/conf.d directory.
    # See http://nginx.org/en/docs/ngx_core_module.html#include
    # for more information.
  #   include /etc/nginx/conf.d/*.conf;
     server {
        listen …
Run Code Online (Sandbox Code Playgroud)

centos nginx asp.net-core-mvc bad-gateway

6
推荐指数
1
解决办法
790
查看次数

一段时间后traefik 502网关错误

问题

我正在运行traefik以在docker容器内提供python django应用程序。该应用程序通过https或http正常运行。经过一段不确定的时间(不到一个小时)后,traefik日志显示“ 502 Bad Gateway ”,而我的nginx和uwsgi日志什么也没说。“ docker restart djangoapp”在短时间内解决了该问题。

设定

互联网-> traefik-> nginx-> uwsgi-> djangoapp

traefik.toml

debug = true

defaultEntryPoints = ["http", "https"]

# Access log
[traefikLog]
  filePath = "/var/log/traefik/traefik.log"
  format = "json"

[accessLog]
  filePath = "/var/log/traefik/access.log"
  format = "json"

[web]
address = ":8080"
        [web.auth.basic]
        users = ["admin:XXX/"]

[entryPoints]
        [entryPoints.http]
          address = ":80"
        [entryPoints.https]
          address = ":443"
          [entryPoints.https.tls]
            [[entryPoints.https.tls.certificates]]
            certFile = "/etc/ssl/traefik/cert-register.stupa.pem"
            keyFile = "/etc/ssl/traefik/key-register.stupa.key"
Run Code Online (Sandbox Code Playgroud)

docker-compose.yml traefik

version: '2'

services:
  frontproxy:
    image: traefik
    container_name: frontproxy
    command: --api --docker --docker.domain=docker.localhost …
Run Code Online (Sandbox Code Playgroud)

nginx uwsgi docker bad-gateway traefik

5
推荐指数
1
解决办法
1358
查看次数