This error occurs when I try to access to the root path ("/") of my MERN application. Though accessing to this path on local machine works fine and I get React application. React app uses 3000 port but server uses 8080. I built my app using this boilerplate: https://github.com/crsandeep/simple-react-full-stack/ (just changing files in "client", "server" and "public" directories and changing paths to client in "webpack.config.js")
I also tried to cover the main component of my app with router (in "index.js" of client) like this:
<Router>
<Route exact path="/" component={MessageBoard} />
</Router>
But I still get the error. What is the issue?
UPD: Contents of server.js is :
const express = require("express");
const logger = require("morgan");
const API_PORT = process.env.PORT || 8080;
const app = express();
const router = require('./routers/board');
app.use(logger("dev"));
app.use('/api', router);
app.listen(API_PORT, () => {
console.log(`LISTENING ON PORT ${API_PORT}`)
});
UPD 1: Contents of "/etc/nginx/sites-available/default":
server {
listen 80;
server_name ec2-18-222-203-253.us-east-2.compute.amazonaws.com www.ec2-18-222-203-253.us-east-2$
location / {
proxy_pass http://127.0.0.1:8080;
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;
proxy_redirect off;
}
}