How to Deploy NodeJS App in GoDaddy Shared Hosting

This post describes the exact steps to deploy a NodeJS app on GoDaddy shared hosting.

  1. Log in to GoDaddy account and click Manage Hosting
  2. In settings, click server and make sure SSH access is on
  3. Click manage against SSH access and note down the credentials
  4. Install a tool (Putty, MobaXTerm, etc.) to connect to the server using SSH
  5. Once connected cd into the directory where you want to deploy a NodeJS app. It will be public_html for main domain or public_html/ in case of subdomain
  6. run the command: wget https://nodejs.org/dist/v6.9.2/node-v6.9.2-linux-x64.tar.xz
  7. Above command will install the node in your directory
  8. Upload your app in zip format and extract in the directory where you want to run the app
  9. run the command node app.js &
  10. If you find an error, make sure to add the code inside the .htaccess file (code available at the end of the list)
  11. To stop existing NodeJS app first run any one of the commands: ps -ef | grep node OR ps aux | grep node
  12. The above command will give you all the running processes, take note of the process id (2nd column from left) you want to stop
  13. Now run the command: kill -9 PROCESS_ID
  14. That’s all. Enjoy 🙂

.htaccess code:

RewriteEngine on
RewriteRule  (.*)  http://localhost:3000/$1  [P,L]
DirectoryIndex disabled

Leave a Comment