I have Nginx setup as a reverse proxy to my node app but I am getting a 504 timeout whenever I try to connect.
Below is the express app
const express = require('express')
var mysql = require('mysql');
const app = express()
const port = 3000
const db = mysql.createConnection({
host : '147.135.85.163',
user : 'u34364_yMVj9u64s4',
password : 'G75q9S9VG2PF3Kel',
database : 's34364_teambans'
});
app.get('/api/get_guardbans', (req, res) => {
db.query('SELECT * FROM tf2jr_guardbans_logs', (error, results, fields) => {
if (error) throw error;
res.send(JSON.stringify(results))
});
})
app.listen(port, () => {
console.log(`Listening at http://localhost:${port}`)
})
This is the nginx config I have
location /api {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_pass http://localhost:3001/api;
}
I tried setting the timeouts like this questions suggest, however that doesn't work