Passenger does not display app.js

Howdy,

Looking for a little bit of help here on DreamHost’s Passenger integration – Let’s see how much preemptive detail I can provide. Any and all help would be greatly appreciated!!

  • I’m on a VPS

  • Utilizing version:
    [ps21170]$ node -v
    v12.18.3

  • .htaccess:
    [ps21170]$ cat .htaccess
    PassengerNodejs /home/familyc22/.nvm/versions/node/v12.18.3/bin/node

  • app.js
    var http = require(“http”);

http.createServer(function(request, response) {
response.writeHead(200, {“Content-Type”: “text/plain”});
response.write("Hello World. This page is running Node.js version: ");
response.write(process.version);
response.end();
}).listen(8888);

  • tree:
    familyc2
  • tmp/
    – restart.txt
  • public/
  • app.js
  • .htaccess
  • Site after node app.js
    image
  • Site after: touch tmp/restart.txt
    (Blank – nothing on it at all)
  • No errors in http/errors.log
  • Access seen in access.log, though

I’ve followed the NPM configuration guide twice, the bin/node file for the version I am using exists and is set as the default. Nothing is found in the console log for visiting the site either. I’m at a complete loss as to what I could be doing wrong. Any and all help would be greatly appreciated! Thank you for your time and consideration.

Passenger should fire up node and load app.js from the domain directory (webroot) that was set in Panel. If a failure is encountered Passenger should print a brief message as a response informing that something went wrong (albeit with little to no detail).

Tree should be:
/home/familyc2/… +

[thedomain.com]
  .htaccess
  app.js
  [public]
    - publicly accessible files
  [tmp]
    - restart.txt

sXi,

That’s how I have it laid out:
image

Except I don’t have the folder called “familyc2.com”, just “familyc2” – but it 404’s if I change that folder name.

Ahh. I didn’t spot the difference with the double 2 in the user name.

Is the index.html file in the public directory blank? If so it might be that you’re manually starting node in shell rather than allowing Passenger to control node and allowing it to handle the running of app.js.

sXi,

Thank you so much for helping me figure this out! I -really- appreciate it.

Unfortunately, it’s not empty.
image

Are you using the 8888 port number in the browser?
A Passenger controlled app.js serves http over port 80 (even 'tho node is “listening” on 8888).

If I do: npm start
I’ll see the expected website in the browser: familyc2.com:8888

Once I exit that, all I see is a blank website at familyc2.com. Passenger does not seem to pick up the site hosting at all.

This is certainly strange behaviour. Passenger usually sends something to the browser as a response even if something goes wrong - and if Passenger isn’t even firing up I’d expect you’d see one of those default “Website is coming Soon!” page that DreamHost sets as a default display rather than a raw directory listing (or a blank page).

I’d be inclined to go into Panel, click on the domain and double check that both the Passenger switch and the NodeJS checkbox have actually stayed set (might have glitched out). If they are, turn them off, try loading the site in a browser to see what happens when served by Apache, then touch /tmp/restart.txt and turn the Panel switches back on again.

It looks like the site is correctly running Node.js, because most URLs produce the “Hello World” message. E.g.:

http://www.familyc2.com/foobar

Hello World. This page is running Node.js version: v12.18.3

The index page appears blank, but it has the title “React App” and if you view source you will see the contents of public/index.html. Similarly, other public files are accessible, like http://www.familyc2.com/manifest.json . For debugging/sanity, you might want to put some static visible HTML in index.html (like <h1>Test React App</h1>) so you know it is loading correctly.

1 Like

Habilis,

I completely misunderstood what I was expecting to see… I was expecting to see the “Hello World” on Index, but it makes sense now that I wouldn’t see it now, since my index.html overrides that default message. Jeez… I was expecting it because when I ran it on port 8888, I saw it.

Thank you so much!

sXi,

Thank you for all your help as well!

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.