将nginx重定向到spring boot-错误502

rdrgkggo  于 2021-07-12  发布在  Java
关注(0)|答案(0)|浏览(319)

在虚拟主机中使用此配置时,总是在ngix中返回错误502:

server {
        server_name apibackend.myserver.com.br;
        listen [::]:443 ssl ipv6only=on; # managed by Certbot
        listen 443 ssl; # managed by Certbot
        location / {
                proxy_pass http://127.0.0.1:8080;
                proxy_set_header Host      $host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-Port $server_port;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header X-Forwarded-Proto $scheme;
        }

    ssl_certificate /etc/letsencrypt/live/apibackend.myserver.com.br/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/apibackend.myserver.com.br/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}

server {
    if ($host = apibackend.myserver.com.br) {
        return 301 https://$host$request_uri;
    } # managed by Certbot

        listen 80;
        listen [::]:80;
        server_name apibackend.myserver.com.br;
    return 404; # managed by Certbot
}

在http://127.0.0.1:8080运行spring boot应用程序并正常。
当我打电话的时候https://apibackend.myserver.com.br returns 错误nginx 502。
我做错什么了?
有人能帮我吗?
谢谢

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题