502 Bad Gateway
nginx/1.24.0
502 Bad Gateway
nginx/1.24.0
502 Bad Gateway
nginx/1.24.0
2024/01/15 03:42:11 [error] 1234#1234: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 203.0.113.5, server: yourdomain.com, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:3000/", host: "yourdomain.com"
2024/01/15 03:42:11 [error] 1234#1234: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 203.0.113.5, server: yourdomain.com, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:3000/", host: "yourdomain.com"
2024/01/15 03:42:11 [error] 1234#1234: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 203.0.113.5, server: yourdomain.com, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:3000/", host: "yourdomain.com"
# Check if your Node/Python/whatever process is alive
ps aux | grep node
ps aux | grep python
ps aux | grep gunicorn # Or check what's listening on your port
ss -tlnp | grep :3000
# Check if your Node/Python/whatever process is alive
ps aux | grep node
ps aux | grep python
ps aux | grep gunicorn # Or check what's listening on your port
ss -tlnp | grep :3000
# Check if your Node/Python/whatever process is alive
ps aux | grep node
ps aux | grep python
ps aux | grep gunicorn # Or check what's listening on your port
ss -tlnp | grep :3000
# If using PM2
pm2 logs --lines 50 # If using systemd
journalctl -u your-app-name -n 50 --no-pager # If using Docker
docker logs your-container-name --tail 50
# If using PM2
pm2 logs --lines 50 # If using systemd
journalctl -u your-app-name -n 50 --no-pager # If using Docker
docker logs your-container-name --tail 50
# If using PM2
pm2 logs --lines 50 # If using systemd
journalctl -u your-app-name -n 50 --no-pager # If using Docker
docker logs your-container-name --tail 50
# PM2
pm2 restart your-app # systemd
sudo systemctl restart your-app # Watch logs as it starts
pm2 logs --lines 0
# PM2
pm2 restart your-app # systemd
sudo systemctl restart your-app # Watch logs as it starts
pm2 logs --lines 0
# PM2
pm2 restart your-app # systemd
sudo systemctl restart your-app # Watch logs as it starts
pm2 logs --lines 0
# Verify your nginx config is correct
sudo nginx -t # Check upstream address matches where your app runs
grep -r "proxy_pass" /etc/nginx/sites-enabled/
# Verify your nginx config is correct
sudo nginx -t # Check upstream address matches where your app runs
grep -r "proxy_pass" /etc/nginx/sites-enabled/
# Verify your nginx config is correct
sudo nginx -t # Check upstream address matches where your app runs
grep -r "proxy_pass" /etc/nginx/sites-enabled/
# PM2 auto-restart config (ecosystem.config.js)
module.exports = { apps: [{ name: 'your-app', script: 'server.js', max_restarts: 10, min_uptime: '10s', watch: false }]
}
# PM2 auto-restart config (ecosystem.config.js)
module.exports = { apps: [{ name: 'your-app', script: 'server.js', max_restarts: 10, min_uptime: '10s', watch: false }]
}
# PM2 auto-restart config (ecosystem.config.js)
module.exports = { apps: [{ name: 'your-app', script: 'server.js', max_restarts: 10, min_uptime: '10s', watch: false }]
}
# 1. Is app running?
ss -tlnp | grep :3000 # 2. App logs
pm2 logs --lines 50 # 3. nginx error log
sudo tail -50 /var/log/nginx/error.log # 4. nginx config valid?
sudo nginx -t # 5. Disk full? (apps crash silently when disk is full)
df -h # 6. RAM full?
free -h
# 1. Is app running?
ss -tlnp | grep :3000 # 2. App logs
pm2 logs --lines 50 # 3. nginx error log
sudo tail -50 /var/log/nginx/error.log # 4. nginx config valid?
sudo nginx -t # 5. Disk full? (apps crash silently when disk is full)
df -h # 6. RAM full?
free -h
# 1. Is app running?
ss -tlnp | grep :3000 # 2. App logs
pm2 logs --lines 50 # 3. nginx error log
sudo tail -50 /var/log/nginx/error.log # 4. nginx config valid?
sudo nginx -t # 5. Disk full? (apps crash silently when disk is full)
df -h # 6. RAM full?
free -h