mk2080 Posted October 2, 2018 Report Posted October 2, 2018 So, i'm trying to setup a nodejs app using the "setup a nodejs app" option in cpanel. But when I try to access the URL where the app is running I get a 503 service unavailable. I have attached a pic of the information used to setup the app. Also, the contents of the application startup file which is index.js is var http = require('http'); var server = http.createServer(function(req, res) { res.writeHead(200, {'Content-Type': 'text/plain'}); var message = 'It works!\n', version = 'NodeJS ' + process.versions.node + '\n', response = [message, version].join('\n'); res.end(response); }); server.listen(); This is basically the default text which hawk host adds to the startup file. This code as it is gave me a 503 service unavailable error , so I tried adding a port number to the server.listen() but I still get the same error. Quote
Brian Posted October 2, 2018 Report Posted October 2, 2018 Welcome to the forums! I believe you have an existing ticket open regarding this issue and I do apologize that ticket was not updated sooner. It looks like the staff member the ticket was assigned to is actually on leave for a bit, we didn't notice the ticket was overlooked, and as a result the ticket sat without a reply. That's my mistake With that said unfortunately I don't know what's causing this particular problem with your Node.js application so I don't have an answer for you here right now. Maybe someone in the community can assist otherwise I've made sure your existing (and already escalated) ticket is re-assigned so hopefully we can debug this through there. Quote
tgonhawk1 Posted October 3, 2018 Report Posted October 3, 2018 Here are some off-the-wall suggestions from someone (me) not really familiar with node.js, so don't be too harsh if they are also off the deep end. 1) When preparing dynamic content via CGI, my understanding is you need two newlines after the Content-type line (if the writeHead function doesn't do that for you). I know leaving those out can generate obscure 5xx errors. 2) Naive guess: should res.end() be res.send() ? seems like a more logical thing for that to be, although it might also just be a typo in trascribing it to the forum, or I could be completely wrong about it. Quote
Tony Posted October 10, 2018 Report Posted October 10, 2018 The code you pasted should be right as it's the default one if it's not working that is very strange. How our Node.js, Python and Ruby application systems work is by utilizing Phusion Passenger except it's Litespeeds own implementation of it. We're going to get a few tutorials up on deploying some common node.js apps as the guides for most applications assume you have your own server. This is obviously not the case with us but the majority of them should still work once you only do the portions that actually apply to deploying the application itself. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.