1 Deploy Nodejs Server on cPanel - Shared Hosting 2023
HTML-код
- Опубликовано: 3 дек 2022
- Tutorial: How to Deploy Node.js backend server on cPanel
In this example my backend listens on a port and connects to mongoDB
www.a2hosting.com/refer/372175
My apologies, RUclips doesn't allow code snippets : (
In the subdomain folder :
.htaccess
*See video for code snippet, also available on A2 Hosting docs
In the node.js app folder:
.npmrc
scripts-prepend-node-path=true
From the terminal:
cloudlinux-selector install-modules --json --interpreter nodejs --user yourusername --app-root yoursubdomainfolder
source /home/yourusername/nodevenv/yoursubdomainfolder/14/bin/activate && cd /home/yourusername/yoursubdomainfolder
npm run start
cron job:
*See video for code snippet
Updating-killing the previous script:
ps faux
kill __________your process id number PID
Backend project for testing: github.com/Peta-S/test-node-app
My Portfolio: www.peta-stewart.com
www.hashtag-metoo.com
Best of luck with your own projects
If "Setup nodejs App" not available on your cPanel, then check this second method for deploying ruclips.net/video/uxKTMHfpuwY/видео.html
I was looking for a clear and concise tutorial on how to deploy a MERN stack app on cPanel, but I couldn’t find any until I stumbled upon your video. You are a lifesaver! 🙌 Thank you for explaining everything so well and providing all the necessary commands/scripts. You made my day! 😊
I ve been stuck for almost 3 days this tutorial It felt like medicine appricciated
Thank you!
edit: My server was not serving my index.ejs on the home route ('/') && following your guide got my express server running + serving the files
Please Upload more videos regarding MERN hosting, and increase video-length.
Thanks 🌹🌹🌹
Thanks a lot
thankyou
tnx, can you pls make another video of nodejs app postgress database.
Can do... but I am working on playlist for "wed dev pathway"... so it will go on the end of the list (unless I get a bit more free time : )
Hello thank you for this tutorial ,
i have problem every things working fine except the file uploading with it's work fine when i run node js from the terminal "node index.js"
but when i run the app from "Setup node js app" only the api with multi part not working .
Did you go through this tutorial step by step. There seems to be some issues with regard to app module. This tutorial show the work arounds.
I have a VPS hosting hosting, but why doesn't my hosting have a cPanel Login? login? If I want to add it, how do I do it? thanks!
Does your VPS hosting company provide cPanel? In a VPS you normally need purchase it. In the even you have purchased VPS with a cPanel account, then your hosting company may need to install the cPanel on your VPS first. After installation they provide you with a link to cPanel's WHM to login with your account password.
I made a website using html,css, javascript for frontend and express nodejs for my backend and my storage using mongodb and store in AWS and run in local host,but I want to deploy my website so can you please help me how to upload and also how to add domain for my website
Please watch the video
Would it be possible for the nodejs app to handle file uploads and store the files in cpanel storage?
You need to do that manually.
Hi, At @4:09 what is 14 in the command.
Is this node version, because I am using 16 version
Yes, 14 is the version number. You will use 16. (I'm slow to reply so you probably already figured it out : )
i don't know how to say thank you to am full with joy i don't know how to start to show my gratitude to you but in all may Almighty God the father of our Lord Jesus Christ Increase your knowledge Amen
I followed each step but when I test api from the postman it says "404 Not Found" ,I deployed nest js app
First, check that your app is running. I check my backend routes while still in dev environment. And I haven't faced any issues deploying live. I have a link to test app in the comments if you need more troubleshooting.
I can't see setup Node Js option on my Cpanel.
How to enable it?
You need to make sure that your provider supplies the module (if you are on a shared server). If you are on VPS you will need to install the module yourself.
You didn't you create any MongoDB database here?
I'm trying to host my mern stack project and I have a cPanel server which does not include MongoDB database as I see
I used MongoDB Atlas which is hosted via AWS (They have a free tier) . As yet cPanel doesn't really support the paid version of MongoDB to be installed. I believe you can do it though.
That was the reason I mentioned you need to make sure the port was open your mongoDB can connect.
You have used es6 module ?
No, I am not sure if express has updated but it wasn't supported when I initially created the app.
Not installed by default and only vps host
Some Shared Hosting hosts have the module installed. As mentioned in the video.
terminal not showing in cpenal
send ticket to your server support team to enable terminal for you
I have an error: cannot connect to any cluster servers
Ok, you'll need to troubleshoot through it. Does you connection work from your local environment? Did you follow all the steps in the tutorial including requesting the port to be opened.
@@peta-stewart I am using a shared CPanel 102.0.24 (i think)
I already contact the tech and they say they can't open port so... it's a loss for me
i have a vps server, in cpanel "Setup nodejs App" is not showing. What can i do?
Same in mine also how to solve it?
@@Yousafzai112 In my case, I switched the hosting service which I used didnt support in-built node js setup.
@@user-kr4ei3ix5m Okay so i also need to change the hosting server or contact with the hosting provider to add the npm module.
@programmingwithafaq3282 @Yousafzai112
@user-kr4ei3ix5m I just uploaded another video with another method for deploying NODE app. See if your hosting has provided access for it. ruclips.net/video/uxKTMHfpuwY/видео.html
Not fun!
Can you help me with this solution Error: spawn app.js EACCES
at Process.ChildProcess._handle.onexit (internal/child_process.js:277:19)
Did you follow the steps in the video? At what point did you get the error?
@@peta-stewart have solved the problem already. The problem was bcrypt but I change it to bcryptjs