Tuesday 9 January 2018

Newbie question: How to deploy a Nodejs application on a webserver ? (like A2 Hosting)

Disclaimer : Sorry for my bad english. I'm french.Hi everyone, I'm currently learning Nodejs and i wanted to make a personal blog. I learned PHP for 4 years at university, I already deployed some PHP apps (with Hostinger for example) and I wanted to start making Nodejs apps.Since I already bought a domain name for my website and subscribed to a Swift plan at A2 Hosting. I could access to my account with SSH and install Nodejs and NPM in my shared hosting. Everything is ok.Now, I'm using Filezilla to access to my server and I am uploading my project. The thing is: I understand that there is a 'public_html' folder, with a sample PHP file (index.php) with a 'cgi-bin' folder. I know I have to make this command to run my app with PuTTy :nohup node app.js & I put the index.php sample PHP script in a 'old' folder. I understand that A2 Hosting only accept running Nodejs apps on 49152 and 65535 ports. So i tried replacing Express port in my app.js with one of these ports :var express = require('express'), routes = require('./routes'), api = require('./routes/api'); var app = module.exports = express.createServer(); var port = process.env.PORT || 65535; app.configure(function(){ app.set('views', __dirname + '/views'); app.set('view engine', 'jade'); app.set('view options', { layout: false }); app.use(express.bodyParser()); app.use(express.methodOverride()); app.use(express.static(__dirname + '/public')); app.use(app.router); }); When I try to run my Nodejs app. "nohup: ignoring input and appending output to `nohup.out'" is displayed in PuTTy. And when I look to the website URL, I have a 503 Service Temporarily Unavailable error.As a newbie, I'm wondering what I should do. I tried looking at Stack Overflow, every A2 Hosting customers seems to have good experience with them and I don't find a topic with a similar issue (so I suspect I made a very newbie mistake). Someone can help me with this issue ? Is there someone who's deploying Nodejs apps with A2 Hosting ?EDIT : grammar

Submitted January 09, 2018 at 08:35AM by tommywalkie

No comments:

Post a Comment