I'm trying to upload my website to my DreamHost VPS but my website isn't showing up once i upload it. I've set the NODE.ENV on my express server/backend to "production". I've installed "compress" and "helmet", i've enabled NodeJS in my panel on DreamHost. I've done everything necessary as far as I know. When i contacted dreamhost, they said they saw this error:
[Sun Aug 18 12:21:34 2019] [error] [client 194.93.59.13] File does not exist: /home/maxcam5/maximecamille.com/public/missing.html
For the most part, here is my app.js express server code. I'm also using React for frontend. I've already built it to be production ready, hence the "build" file.
Everything works when I run tests on my computer and start my website from my express server.
const express = require('express');
const bodyParser = require('body-parser');
const nodemailer = require('nodemailer');
const path = require('path');
const compression = require('compression');
const helmet = require('helmet');
const config = require('./config/config');
const app = express();
. . .
app.use(compression());
app.use(helmet());
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: false}));
app.use(express.static(path.join(__dirname, 'my-app', 'build')));
app.get('/*', function (req, res) {
res.sendFile(path.join(__dirname, 'my-app', 'build', 'index.html'));
});
. . .
const port = process.env.PORT || 5000;
app.listen(port, () => {
console.log(`Server listening on port ${port}`);
console.log(process.env.NODE_ENV);
});
Heres the article explaining how to enable NodeJS on Dreamhost: https://help.dreamhost.com/hc/en-us/articles/216635318-How-to-enable-Node-js