Health check


<aside>

404 error


  1. apache or nginx install

2-1. apache

<Location /health>
    SetHandler server-status
</Location>

sudo systemctl restart apache2

2-2 nginx

location /health {
    return 200 "OK";
    add_header Content-Type text/plain;
}

sudo systemctl restart nginx

</aside>

node.js


<aside>

const express = require('express');
const app = express();
const PORT = process.env.PORT || 3000; //80으로 변경 alb가 열어둔 포트

app.get('/health', (req, res) => {
  res.status(200).send('OK');
});

app.listen(PORT, () => {
  console.log(`Server running on port ${PORT}`);
});

</aside>