1

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

MCam
  • 79
  • 5
  • Have you checked the file `missing.html` exist or not? As the error clearly says that the file is missing. Secondly you are running reactjs and nodejs on single port or having different ports for backend and frontend? – Abdulhaq Shah Aug 19 '19 at 04:53
  • @AbdulhaqShah Thats the thing, I'm not sure why I would need an missing.html because according to DreamHost, as long as I have an app.js file (that being my express server backend) then, because I have Passenger and NodeJS enabled in my panel, my server should run my website fine, but its not. Also I'm running reactjs and nodejs on the same ports i believe. – MCam Aug 19 '19 at 13:56

0 Answers0