Welcome! Log In Create A New Profile

Advanced

Why 502 Bad Gateway error?

April 15, 2024 11:37AM
Hello,
The Nginx configuration is as below:

upstream nodejs {
server nodejs:3000;
}

server {
listen 80;
server_name default_server;
error_log /var/log/nginx/error.system-default.log;
access_log /var/log/nginx/access.system-default.log;
charset utf-8;


root /usr/share/nginx/html;
index index.html index.php index.js;
location ~ \.js$ {
proxy_pass http://nodejs;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}

location / {
autoindex on;
try_files $uri $uri/ $uri.html =404;
}
}

Why I got the following error:

# curl localhost/app.js
<html>
<head><title>502 Bad Gateway</title></head>
<body>
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx/1.25.4</center>
</body>
</html>

Thank you.
Subject Author Posted

Why 502 Bad Gateway error?

hack3rcon April 15, 2024 11:37AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 133
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready