Deploy Node.js Apps To Shared Hosting

Поделиться
HTML-код
  • Опубликовано: 4 ноя 2024

Комментарии • 96

  • @WatchandLearnTutorials
    @WatchandLearnTutorials  2 года назад +1

    PLEASE READ BEFORE COMMENTING:
    so this video is here just to show you that you could IN THEORY deploy Node apps to shared hosting. HOWEVER, you should not be doing this for any type of production website, because it will probably not work well and even if you use something like PM2 it will just stop working after a few days. If you wanna deploy Node apps better use something like Digital Ocean or AWS. You can use this link to get $100 credit on Digital Ocean over 60 days so you can play around with it: m.do.co/c/808fb4bb0039

  • @Skwlx
    @Skwlx 4 года назад +5

    Thank you very much! I was searching for a video like this for days!

  • @alex-desroches
    @alex-desroches 4 года назад +4

    Thanks man I've never gotten so far into deploying as with you

  • @karthipalani7373
    @karthipalani7373 3 года назад +1

    Without this I ain't able to deploy project to live thanks dude

    • @WatchandLearnTutorials
      @WatchandLearnTutorials  3 года назад +1

      Glad I could help 😀 , but as I said in the video this setup is not ideal. So keep that in mind.

  • @aleksandermirowsky7988
    @aleksandermirowsky7988 4 года назад +2

    Just discovered your channel a few days ago and let me just say that your content is legendary. Amazing stuff all around. Good job, mate. Cheers!

  • @ledeadeniyi
    @ledeadeniyi 4 года назад +4

    Thank you for this! I'm also looking forward to Easy Deployment with Git and CPanel. Especially how to handle automatic deployments

  • @genxindia1154
    @genxindia1154 4 года назад +2

    Thanks man I wish have found you earlier, I wanted to deploy ghost on my Cpanel but couldnt but now tis already too late I am on wordpress now but I have saved this video in case I need this in future ever.

    • @WatchandLearnTutorials
      @WatchandLearnTutorials  4 года назад +2

      But remember, as I've said in this video shared hosting with cPanel is not a good solution. Better stick to WP for shared hsoting, and host node apps on something like Digital Ocean.

    • @genxindia1154
      @genxindia1154 4 года назад +1

      @@WatchandLearnTutorials Thanks I will keep that in mind

  • @DanielScottFilms
    @DanielScottFilms 2 года назад

    Great tips. I'll be deploying a Strapi app soon!

    • @WatchandLearnTutorials
      @WatchandLearnTutorials  2 года назад

      Don't do it this way please 😀 as I said in the video this is not good for production websites. Better use something like Digital Ocean, AWS, etc. This is only going to cause you headaches.

    • @DanielScottFilms
      @DanielScottFilms 2 года назад

      @@WatchandLearnTutorials If I'm on Centos, would it be less of a headache if I installed with Pm2?

    • @WatchandLearnTutorials
      @WatchandLearnTutorials  2 года назад

      @@DanielScottFilms You should use PM2 for sure, however on my shared hosting even after using PM2 the site would still go offline every 2,3 days, and I would have to restart it manually. Of course on Digital Ocean this works great.

  • @nickxipakis2380
    @nickxipakis2380 4 года назад +4

    Unfortunately my host server not support node js.. at last i use heroku to deploy..i want thank you!! and keep on to help people to solve issues

  • @Zmiize94
    @Zmiize94 4 года назад +2

    I followed your guide as much as I could being that shared hosting sites are different across countries. For instance, the Cpanel I'm currently using doesn't have NodeJS runner, instead I installed node on the terminal, but it uses jailshell.
    The issue I had was that everytime i tried installing the node modules for strapi, the sharp library installation would fail as some of its modules like "libvips" would fail to compile in jailshell. So I cannot complete this process thoughly as I'm limited by the shell, other than that I guess using this sort of shared hosting works with nodeJS as long the npm modules don't need to compile on the target system. If you know a way around that, let me know.

    • @WatchandLearnTutorials
      @WatchandLearnTutorials  4 года назад

      You could try just copying node_modules from your local machine, but that would suck very much. As I've said in the video Node apps should not be deployed on shared hosting for the time being. I've even had problems in this video. It's much better to use something like digital ocean or AWS. I have a video about that, you can check that out if you like: ruclips.net/video/IktnuT9UgbM/видео.html

    • @teras8303
      @teras8303 3 года назад

      Hi, im facing almost the exact same issue with the sharp module and the libvips that is required by strapi-plugin-upload. Did you manage to solve this issue?

    • @Zmiize94
      @Zmiize94 3 года назад

      @@teras8303 No, the shared hosting you may be using won't allow for some node packages to compile in jailshell.
      Try Directus 8 or another type of cms based on php instead.

  • @stephenrogers5458
    @stephenrogers5458 4 года назад

    This is a great tutorial. I am following it to work with A2Hosting, but my situation requires deploying a Vue app with Express / MySQL back end (the Node part). On my dev environment I am able to serve the Vue app in production (built) mode by having Express serve Vue as well as the api. I have not yet succeeded with this on A2Hosting. I am following the advice from this tutorial and creating a subdomain.
    If you have advice on this, I would appreciate it!

    • @WatchandLearnTutorials
      @WatchandLearnTutorials  4 года назад

      As I've said in the video this solution is not optimal, and it should not be used for critical projects, only for personal projects. Because even if you are able to make it work, chances are that your app would stop working after a few days and you would have to manually restart it. So that sucks. Better use something like Digital Ocean. I have a video about that also: ruclips.net/video/IktnuT9UgbM/видео.html

  • @_boza
    @_boza Год назад

    Do you have a video for deploying FE part?

  • @kaveshriskmanagment5804
    @kaveshriskmanagment5804 3 года назад

    First of all thanks a lot for making this video, it help me a lot but there is an issue when I ssh to server and then go to that directory where my application live, and write npm install I get this error "-bash: npm: command not found"
    although my cpanel is supporting node js app, if you could help me to solve this problem it would be appreciated.

    • @WatchandLearnTutorials
      @WatchandLearnTutorials  3 года назад +1

      Well seems to me that your server doesn't have Node.js installed or npm. However Node usually comes with npm out of the box so I would say that your server doesn't have Node.js installed at all, or is using some super old version. You have to check that with your hosting provider.

  • @jhonatansantofimio3764
    @jhonatansantofimio3764 2 года назад +1

    npm install
    -bash: npm: command not found

    • @WatchandLearnTutorials
      @WatchandLearnTutorials  2 года назад

      You don't have npm installed on your host, that probably means that you don't have Node.js installed. Try contacting your hosting to see if they have servers with Node. And also please read the pinned comment before that and then decide do you even wanna try this.

  • @vanmartyr
    @vanmartyr 3 года назад +1

    Hi, is it possible for me to host strapi and also a front end (angular) that uses data from strapi on the same domain?

    • @WatchandLearnTutorials
      @WatchandLearnTutorials  3 года назад

      It is. But don't do it. At least not on shared hosting, as I've said in this video this is not good solution for production apps. Better use something like Digital Ocean, AWS, etc.

    • @vanmartyr
      @vanmartyr 3 года назад

      @@WatchandLearnTutorials thanks, yeah I was looking at digital Ocean. I'm just moving away from using monolithic CMS like umbraco, and I'm surprised by cost and effort it seems to take to host headless solutions

    • @WatchandLearnTutorials
      @WatchandLearnTutorials  3 года назад +1

      @@vanmartyr Yup. Sometimes I ask myself if it's even worth it 😀

  •  3 года назад

    for your case, it will be better to build a project locally and then send it to host over FTP

    • @WatchandLearnTutorials
      @WatchandLearnTutorials  3 года назад

      I think I did that in the video.

    •  3 года назад

      @@WatchandLearnTutorials you uploaded to shared host installed npm packages and then build it on the shared host

    • @WatchandLearnTutorials
      @WatchandLearnTutorials  3 года назад

      @ No I didn't 😀 ... I tried to build it, but that failed (not enough memory). Then I did what you suggested.

  • @sameeraperera7912
    @sameeraperera7912 4 года назад +1

    thank you.....

  • @sgares6741
    @sgares6741 3 года назад

    Thanks man. How do I connect my strapi app with the MySQL that my hosting provides though ? (instead of using data.db)

    • @WatchandLearnTutorials
      @WatchandLearnTutorials  3 года назад

      Don't use this for production, shared hosting is not good for this type of setup, better use something like Digital Ocean or AWS. I'm not even sure how you can connect to MySQL on shared hosting or even if it's possible.

  • @aceracer5556
    @aceracer5556 2 года назад

    Hello! How to config nginx ssl?

  • @mykola.kushka
    @mykola.kushka 2 года назад

    It looks I am able to run on my shared hosting only in development mode (blue label "Development" - on Strapi page). And I am not able to run in Production mode (green label). Not sure if there any difference for Strapi?

    • @WatchandLearnTutorials
      @WatchandLearnTutorials  2 года назад +1

      Production mode is better performant. Since you are using this on shared hosting the problem probably is that you don't have enough resources to make a production build. That's why I say in the video that this is not production ready, and you would be better off using something like AWS, Digital Ocean etc.

  • @rajeshmondal8392
    @rajeshmondal8392 2 года назад

    Hello sir, I have a node js backend and react frontend web application with lerna monorepo. How can I deploy it in one subdomain in cpanel?

    • @WatchandLearnTutorials
      @WatchandLearnTutorials  2 года назад

      No idea. Sorry. Also, do not do this on shared hosting (if it's even possible) because you're gonna have a bad time. Shard hosting is not made for something like this.

  • @doyouknow1948
    @doyouknow1948 4 года назад

    Hi... Thank You...can you explain how angular and nodejs (express back end) app deploy in shared hosing..using CPanel option 'setup Node.js app' i tries but doesnt work...

    • @WatchandLearnTutorials
      @WatchandLearnTutorials  4 года назад +1

      I never used Angular, so can't really help you there. But as I've said in this video this setup is not optimal for node apps, you really should be using something like Digital Ocean.

  • @nimeshthakor2546
    @nimeshthakor2546 4 года назад +1

    hey i have some problem i have upload my code to server and thats perfectly run fine but after 2 or 3 days the server automatically stopped and i have to restart it again :( any solution for this?

    • @WatchandLearnTutorials
      @WatchandLearnTutorials  4 года назад

      Yes, don't deploy your apps on shared hosting, as I said in the video there are still problems with that unfortunately. The same thing happened to, even when using PM2, so that sucks. Better use something like Digital Ocean... also I have a video about that that you can check out: ruclips.net/video/IktnuT9UgbM/видео.html

  • @teras8303
    @teras8303 3 года назад

    Hello Ivan , thanks for the video. Unfortunately I tried deploying my strapi proyect to Namecheap shared hosting servers using the create nodejs application method and the CLI but wasnt able to get the development server to work. For both cases I had similar issues with the sharp module. Im getting the following error: Cannot find module '../build/Release/sharp.node' ,im using node v10.24.1 and 6.14.12. Do you know if I could try using an older strapi version? Thanks

    • @WatchandLearnTutorials
      @WatchandLearnTutorials  3 года назад

      Probably not. You need to have at least version 12 of Node.js to be able to run Strapi. So if your hosting does not support that, then you are out of luck, sorry. And also as I mentioned in the video this is just to show that this can be done on shared hosting, but IMO you should not deploy production Node.js apps to shared hosting. It's very unstable, you should use something like Digital Ocean or AWS or something similar.

  • @kirarevcrow
    @kirarevcrow 3 года назад

    Can we host strapi and React on the same share hosting? like cPanel?

    • @WatchandLearnTutorials
      @WatchandLearnTutorials  3 года назад

      Technically yes. But as I said in the video this setup is not production ready. At least not on my hosting, you may have better luck with your hosting however. But I still think that something like AWS, Digital Ocean etc. is much better option.

  • @case_tips
    @case_tips 2 года назад

    Hi how to solve npm not found issue?

    • @WatchandLearnTutorials
      @WatchandLearnTutorials  2 года назад

      You probably can't, if Node/NPM is not installed on your shared hosting there is little chance that you can install it yourself. You can try contacting your hosting company to see if they would install it for you, but even if they do this would be a waste of time. Please read pinned comment for more info.

  • @mmlnv2036
    @mmlnv2036 3 года назад

    Npm doesn't get recognized as a command , any ideas ?

    • @WatchandLearnTutorials
      @WatchandLearnTutorials  3 года назад

      You don't have Node and NPM installed on the server probably. And since you are using shared hosting I doubt that you can install it yourself, you would probably need to contact your hosting provider.

  • @oritkozolin7821
    @oritkozolin7821 4 года назад

    But how do you deploy the NextJS part to shared hosting with cPanel ? The main problem is that the build of NextJS does not include any startup file that can be used in the 'Node' app settings in cPanel. How do you go around that?

    • @WatchandLearnTutorials
      @WatchandLearnTutorials  4 года назад +1

      You can create a start file. And in fact I did that in this episode: ruclips.net/video/IktnuT9UgbM/видео.html where we deployed our app on Digital Ocean. I think you could use that start file for cPanel also: github.com/ivandoric/Making-Websites-With-Next.js-And-Strapi/blob/master/digital-ocean/start-files/NextApp/start.js

    • @oritkozolin7821
      @oritkozolin7821 4 года назад

      @@WatchandLearnTutorials Thanks, just what i was missing!

  • @groovebird812
    @groovebird812 3 года назад

    How do you connect the subdomain with strapi? In your video strapi is running on localhost but i think your subdomain runs under a public ip and not localhost

    • @WatchandLearnTutorials
      @WatchandLearnTutorials  3 года назад

      Strapi and other Node.js apps are always going to run on localhost. But I explain in this video how to run it on subdomain. What is the problem you are running into?

    • @groovebird812
      @groovebird812 3 года назад

      @@WatchandLearnTutorials i want to run strapi on a production server with a domain and not local. if i enter my domain in the browser nothing happens. I can't see the strapi backend, because it runs on localhost. Localhost is not accessible from outside. How did you solve this? What are you doing that you can enter your subdomain and the strapi backend is working.

    • @WatchandLearnTutorials
      @WatchandLearnTutorials  3 года назад

      @@groovebird812 It is actually shown in the video. And as I've said Node.js apps always run on localhost, but localhost is not just on your machine, if you run it on the server it's going to run on that servers localhost on port 1337. And I'm actually setting my subdomain in the video around 2:30 mark. So I still don't see what problem you are running into. Also keep in mind (and I talk about this in the video) that you should NOT put your production app on shared hosting, this video was just to show that it can be done, but it doesn't mean you should do it, because it won't work well. It would be much better to use something like AWS, Digital Ocean or any of the other similar services.

    • @groovebird812
      @groovebird812 3 года назад

      ​@@WatchandLearnTutorials it was my fault, sorry. I had to enable port 1337 on my testserver. I didn't know that the domain on port 1337 will internally be mapped to show contents from localhost:1337. Is this because of the port? I always want to understand whats going on but with this i don't understand it completly :-) The htaccess i will try later :-)

    • @WatchandLearnTutorials
      @WatchandLearnTutorials  3 года назад

      @@groovebird812 You did good, sometimes ports are "locked" and if your site is using unlocked port it will not work. Usually node apps run on a specific port so you have to enable those, or set it to run on port 80 or 8080 which is in most cases default port for serving web sites, but most times you can't set that on shared hosting because port 80 is reserved for public_html directory.

  • @ramone09
    @ramone09 3 года назад

    my cPanel does not have "Setup Nodejs App" tool. How can I install it?

    • @WatchandLearnTutorials
      @WatchandLearnTutorials  3 года назад +1

      You probably can't. If it's not there, then your hosting provider probably doesn't want you to have it. You can try asking them to install it for you, but I wouldn't get your hopes up. However as I said in this video and in the comments, this is not optimal solution for Node apps, much better to use Digital Ocean, AWS or similar services.

  • @lamargtv2572
    @lamargtv2572 3 года назад

    Error
    /home/dgpmallc/nodevenv/nodejsapp/12/bin/npm: fork: Cannot allocate memory
    I get this error when i run npm install. Can anyone tell me why?

    • @WatchandLearnTutorials
      @WatchandLearnTutorials  3 года назад

      I think I had the same problem in this video. That's why I suggest that you build your site locally. And the error is just what it says, there is not enough memory to build the site. And also as I said in the video this setup is just to show that it can be done, but if you wanna have a production ready app that people are gonna use, don't use shared hosting, because there are problems with it as you can see. Better try AWS or Digital Ocean or something similar.

  • @isthatsahil
    @isthatsahil 3 года назад

    Getting 403 forbidden error when creating a sub-domain on root directory instead of public_html folder.. Can someone please help ?

    • @WatchandLearnTutorials
      @WatchandLearnTutorials  3 года назад +1

      Why don't you create sub domain in public_html? Maybe your hosting provider doesn't allow for sites to be outside public_html. Also note that this video is just to show that something like this is possible, but honestly, you shouldn't put your production node.js app on shared hosting. Better use something like Digital Ocean.

    • @isthatsahil
      @isthatsahil 3 года назад

      @@WatchandLearnTutorials thanks for the help.. also if you can explain what’s the difference between shared hosting like goDaddy and digitalOcean?

    • @WatchandLearnTutorials
      @WatchandLearnTutorials  3 года назад

      @@isthatsahil Read first two answers on here: www.quora.com/How-is-a-DigitalOcean-droplet-different-than-a-shared-host-security-wise and just remember, if using DO you mostly have to setup everything yourself, but you have much more control over everything, because technically you get your OWN server , as opposed to shared hosting where you... well, SHARE you hosting with other people.

  • @tebarei
    @tebarei 4 года назад +1

  • @ashishmangla221
    @ashishmangla221 4 года назад

    how i can host next js project on cpanel

    • @WatchandLearnTutorials
      @WatchandLearnTutorials  4 года назад

      Try this: www.a2hosting.com/kb/cpanel/cpanel-software/create-application-with-nodejs-selector as I've said, cPanel/shared hosting is not ideal solution for deploying NodeJS apps. Better use something like Digital Ocean: ruclips.net/video/IktnuT9UgbM/видео.html

  • @adrianfam8098
    @adrianfam8098 2 года назад

    I cant get it to work :(:(

  • @tebarei
    @tebarei 3 года назад

    bro ¿how i can use SSL?

    • @WatchandLearnTutorials
      @WatchandLearnTutorials  3 года назад +1

      You have to install SSL certificate for your domain. Try finding out if your hosting supports Let's Encrypt (letsencrypt.org/) so that you don't have to pay for the SSL certificate. This is not really my strong suit so that is the most info I can offer you.

    • @tebarei
      @tebarei 3 года назад

      can you make a video tutorial to make it work in ssl? my cpanel gives me SSL and I can't find how to make it work 😢😢

    • @WatchandLearnTutorials
      @WatchandLearnTutorials  3 года назад +1

      @@tebarei You have to talk to your hosting provider about that. It tends to be different from provider to provider, so I can't make a tutorial for most people, only for the provider I use.

  • @zaheerRock
    @zaheerRock 3 года назад

    title not justify , its all about strapi crap!!

    • @WatchandLearnTutorials
      @WatchandLearnTutorials  3 года назад

      Strapi is a Node.js App. I don't see the problem. Similar steps should be taken for any other Node app.

  • @mbparvezme
    @mbparvezme 2 года назад

    Hello Ivan. Thank you for this awesome video. This is the first time I'm working with Strapi on the cPanel server. Your "npm install" shows no error. But in my case "npm install" script had the following error. Could you please help me with this?
    ...
    40101 warn @strapi/helper-plugin@4.0.3 requires a peer of qs@6.10.1 but none is installed. You must install peer dependencies yourself.
    40102 warn react-virtualized@9.22.3 requires a peer of react@^15.3.0 || ^16.0.0-alpha but none is installed. You must install peer dependencies yourself.
    40103 warn react-virtualized@9.22.3 requires a peer of react-dom@^15.3.0 || ^16.0.0-alpha but none is installed. You must install peer dependencies yourself.
    ...

    • @WatchandLearnTutorials
      @WatchandLearnTutorials  2 года назад +1

      Don't use this for production. You should not deploy node apps to shared hosting because it won't work as expected. Better use Digital Ocean, AWS or similar. As for the errors it says that you need to install peer dependencies yourself. So try doing that: npm install qs@6.10.1 react@^15.3.0 react-dom@^15.3.0 ...

    • @mbparvezme
      @mbparvezme 2 года назад +1

      @@WatchandLearnTutorials Thank you for your reply. Already started with AWS.

    • @WatchandLearnTutorials
      @WatchandLearnTutorials  2 года назад

      @@mbparvezme Nice 👍