How to Host Multiple Node Apps with nginx and pm2
In this tutorial i'll show you how to host multple Node apps on a single serverwith nginx and pm2.
Read the article here: codebubb.com/posts/how-to-host-multiple-node-apps/
Get $200 free Digital Ocean credit using this link! www.juniordevelopercentral.com/digitalocean
00:00 Intro
00:30 What you’ll need
00:45 Setting up the 1st Node app
01:50 Using PM2
02:45 nginx reverse proxy
05:03 Adding a 2nd Node app
As mentioned at the start of the video, some extra help getting you set up if you don't have nginx, node and pm2 installed:
- Nginx installation kzread.info/dash/bejne/ZX9h0qWNh5nVgpc.html
- Node.js installation kzread.info/dash/bejne/dn58xseqqLeyXdo.html
- PM2 installation kzread.info/dash/bejne/ap5tuJmxYpfRYJs.html
OK so this was actually a viewer's question from a previous video that dealt with how to add a new SSH key to an old server.
The question was asking how to host multiple Node apps on one server/IP so this video will show you how to use nginx, PM2 and of course Node.js to create multiple apps all running under the one domain.
#nodejs #nginx #digitalocean
Пікірлер: 29
Thank you. No fluff, clear instructions. Got it running on the first try.
@codewithbubb
9 ай бұрын
Cheers! Glad you got it working. I hate fluff 🤣
Quick, concise, and clear! Thank you heaps
@codewithbubb
2 ай бұрын
Thanks very much. Hope it helped you out.
Hey James, Thanks a lot for creating this video.
@codewithbubb
Жыл бұрын
You’re welcome! Hope it answered your question (let me know if not!).
Thanks, this is clean and simple
Very clear explanation, thanks a lot.
@codewithbubb
6 ай бұрын
You’re welcome. Hope it helps you out.
THANKYOUU SO MUCHHH!!🤩🤩🤩🤩🤩🤩
This is a great topic. All apps seem to run on port 80
@codewithbubb
Жыл бұрын
Yeah, if you wanted to make use of SSL if you have it setup you would want to move those ‘location’ blocks into the nginx conf section that manages that 👍
wasn't working for me until I put the / at the end of my proxypass -_-
@blockchainandweb3120
Жыл бұрын
Thanks bro. Do you know why is that ?
@netsaosa4973
Жыл бұрын
@@blockchainandweb3120no idea
@marcuschong1660
Жыл бұрын
Thank you. So glad to see this comment. I've been spending hours to figure out the issue only to come across your solution that works
@ljlinen
3 ай бұрын
thanks bro, this also worked for me, i wasted a lot of energy on just a slash '/' dang
On the page with text descriptions.. Change to this: sudo systemctl reload nginx Since this sudo "sudo systemctl nginx reload" give an error.
@janstergaard703
3 ай бұрын
Thank a lot for your video!
@codewithbubb
3 ай бұрын
Thanks so much for this - i'll update it!
Have a problem how get another folder file😕 Please advise.
@wingmanup7368
Жыл бұрын
use the touch command. For example touch
Dear Codebubb, The first thank big for you. I had problems. - after install nodejs, npm, pm2 - when i action: pm2 list -->Spawning PM2 daemon with pm2_home=/home/vietk/.pm2 and pm2 start app.js -->Spawning PM2 daemon with pm2_home=/home/vietk/.pm2 --> it can not show table as you was worked. I had tried many method( install Os Ubuntu 22.04 , install nodejs..., but it still have problems as above Can you and everybody help me! Thnak you so much.
@codewithbubb
9 ай бұрын
Hi, how did you install pm2? It could be it was installed with elevated privileges (root?) and then you're running it as another user? Try sudo pm2 list and see if you still get the error.
@hoatranquang8376
9 ай бұрын
@@codewithbubb Dear you, it still error -->Spawning PM2 daemon with pm2_home=/home/vietk/.pm2 Thank you
@codewithbubb
9 ай бұрын
Did you try it as root? Are you able to run any other node stuff on your server? Try running with debug to see if there is any more info: DEBUG=* pm2 list Also, check your disk isn't full and also check the permissions/ownership of your pm2 module e.g. ls -alh /usr/local/lib/node_modules/pm2 (or wherever your global node_modules are).
@hoatranquang8376
9 ай бұрын
@@codewithbubb Thank you so much. I installed nodejs and pm2 by manual Result is ok
@codewithbubb
9 ай бұрын
@@hoatranquang8376 Ah great! Glad to hear you got it sorted.