Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

187
Visualizações
400 Bad Request load balancer for Apache servers with NGINX

I am using NGINX as load balancer for Apache WebServers (WordPress). All servers are made with AWS EC2. My config for NGINX:

cat /etc/nginx/sites-available/default



upstream web_backend {
        server 35.157.101.5;
        server 35.156.213.23;
}

server {
        listen 80;
        location / {
                proxy_pass http://web_backend;
        }
}

But after NGINX restart i am access load balancer via public ip and getting an error:

Bad Request

Your browser sent a request that this server could not understand.

Additionally, a 400 Bad Request error was encountered while trying to use an ErrorDocument to handle the request.

Apache/2.4.29 (Ubuntu) Server at ip-172-31-35-36.eu-central-1.compute.internal Port 80

If i refresh page i am getting same error but with another ip in the end (second server’s private ip), so i understand that NGINX do the work and it is Apache problem. I tried to add 80 port for my servers in nginx config, replace ips with dns and private ip, but it didn’t help. Access log on Apache doesn’t show anything useful, just 400 errors. What could be the problem?

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

Don’t use ‘_’ for upstream name, it was the only reason for my problem.

over 4 years ago · Santiago Trujillo Relatório

0

Just check on which ports are the Apache WebServers Running. You have to add those to your upstreams.

E.g.:

upstream web_backend {
        server 35.157.101.5:8080; //assuming that your apache webserver is running on this port on this host
        server 35.156.213.23:3000;//And a different port on the other.. you still need to add them here if your ports are same
}
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda