Lädt...


🔧 Hosting a NodeJS Web App on Ubuntu Server 22.04


Nachrichtenbereich: 🔧 Programmierung
🔗 Quelle: dev.to

Let's dive into setting up and running a Node.js server on a Linux Ubuntu machine, and guess what? We're not starting from scratch! 🚀 We'll be using the super sleek one-file server I crafted in a previous article. If you missed it, don't worry—you can catch up right here. Get ready to turbocharge your server setup and have some fun along the way! 🎉👨‍💻

Ready to bring your Node.js project to life on your local server? 🌟 Let's roll up our sleeves and jump right in!

First up, let’s snatch the project from GitHub. Go ahead and clone the repository with this slick command:

git clone https://github.com/EneasLari/singlefilenodejs.git

alt text

Next step on our adventure: saddle up those dependencies! 🚀 Run this command in your project directory:

npm install

alt text

Don’t have MongoDB installed yet? No stress! Follow these easy-peasy instructions right here to get set up.

Now, let's fire up that server with:

npm run dev

And watch the magic happen! 🧙‍♂️

alt text

Want to show off your server to the world? 🌍 Let's open up port 5000! Here’s how to make it available using UFW, the Uncomplicated Firewall:

sudo ufw allow 5000/tcp

And voilà! Your local server is now ready to welcome visitors from anywhere, just like a party host opening the gates to an awesome backyard bash! 🎉

Now, pull up your browser and take your freshly served Node.js app for a spin! 🎢 Happy coding!

Here’s how to do it:

Step 1: Check UFW Status
First, check if UFW is enabled on your system:

sudo ufw status verbose

If UFW is not active, enable it with:

sudo ufw enable

This command will start the firewall and ensure it is set to start automatically when your system boots.

Step 2: Allow Port 5000
Specify if the rule applies to TCP or UDP traffic. If your application requires both protocols, you should enable both. Here's how to do it:

sudo ufw allow 5000/tcp
sudo ufw allow 5000/udp

If you only need it for one protocol, you can just run the respective command.

Step 3: Verify the Changes
After adding the rules, it's important to verify that they have been implemented correctly:

sudo ufw status

This command will list all active rules, including the newly added entries for port 5000, confirming that it has been opened successfully.

Additional Notes:

  • Purpose of Port 5000: Port 5000 is commonly used for web server development (e.g., Flask and other frameworks often use this port by default) as well as some media services. Ensure that opening this port is safe within your network environment and aligns with your security policies.
  • Logging and Monitoring: For security, consider enabling logging for UFW:
  sudo ufw logging on

This helps in keeping track of attempted connections, aiding in security audits and troubleshooting.

Alright! 🌟 Now you're all set up and ready to roll! Just point your browser to your server's IP and the magic port 5000. Here's an example, but remember, your server IP might be different:

🌐 Check out: http://192.168.72.128:5000/

alt text

And just like that, you've got your Node.js server humming along on your local setup! 🎉

Stay tuned! In our next article, we're going to level up and introduce PM2 to keep your server running smooth like butter, even when you close your terminal. Think of it as hiring a little digital assistant to keep the lights on 24/7! 🤖✨

So, pat yourself on the back, grab a cup of your favorite brew, and take a moment to revel in your success! 🔥

...

🔧 Hosting a NodeJS Web App on Ubuntu Server 22.04


📈 39.03 Punkte
🔧 Programmierung

🔧 Aligning NodeJS with the Web: Should NodeJS Implement The Same APIs as the Web Browser?


📈 34.47 Punkte
🔧 Programmierung

🔧 What is Web Hosting - Web Hosting Explained


📈 29.15 Punkte
🔧 Programmierung

🔧 Hosting NodeJS application on Windows server


📈 27.48 Punkte
🔧 Programmierung

🐧 Ubuntu Server: Set Up Your Own Server For Web Hosting ( Step By Step )


📈 25.99 Punkte
🐧 Linux Tipps

🕵️ KingNull leaks DB of Daniel’s Hosting dark web hosting provider


📈 25.31 Punkte
🕵️ Hacking

🕵️ FlokiNET Hosting - Your best choice in web hosting


📈 25.31 Punkte
🕵️ Hacking

💾 Web Hosting Guide: Top 5 Features Of Cloud Hosting For Websites


📈 25.31 Punkte
💾 IT Security Tools

🕵️ 6,500+ sites deleted after Dark Web hosting provider Daniel’s Hosting hack


📈 25.31 Punkte
🕵️ Hacking

🕵️ NVIDIA GeForce Experience prior 3.20.5.70 Web Helper NodeJS Web Server uncontrolled search path


📈 24.43 Punkte
🕵️ Sicherheitslücken

🔧 Deploy Backend API NodeJs to Hosting Dewaweb


📈 24.13 Punkte
🔧 Programmierung

🔧 Facing issue while hosting my first Nodejs project on Vercel


📈 24.13 Punkte
🔧 Programmierung

🔧 How to Setup a Simple HTTP Server/ Local Web Server with NodeJS


📈 23.95 Punkte
🔧 Programmierung

🔧 Comparing Web Design, Web Development, and Web Hosting: A Comprehensive Guide


📈 22.26 Punkte
🔧 Programmierung

🕵️ Design & Hosting by Mando Hosting / SQL Injection


📈 21.47 Punkte
🕵️ Sicherheitslücken

📰 UK & EU hosting: Best hosting providers with data centers in Europe


📈 21.47 Punkte
📰 IT Security Nachrichten

🪟 These four major U.S. hosting companies let you resell their hosting


📈 21.47 Punkte
🪟 Windows Tipps

🪟 These hosting companies let you resell their hosting to others


📈 21.47 Punkte
🪟 Windows Tipps

🕵️ Top Video Hosting sites (2019) - Best video hosting for 2019


📈 21.47 Punkte
🕵️ Hacking

🔧 JavaScript Web Server using Nodejs


📈 20.59 Punkte
🔧 Programmierung

🔧 Build an Event Calendar App Using NodeJS, VueJS, and SQL Server (Step by Step Tutorial)


📈 19.76 Punkte
🔧 Programmierung

🔧 A Guide To Self-Hosting Web Apps On Ubuntu Servers


📈 19.28 Punkte
🔧 Programmierung

🐧 CentOS vs Ubuntu for Web Hosting


📈 19.28 Punkte
🐧 Linux Tipps

🐧 Which one to learn as the first linux. Ubuntu or Centos for the purpose of web hosting


📈 19.28 Punkte
🐧 Linux Tipps

🔧 How to setup an Apache server on Ubuntu 22.04.4 LTS with Virtual hosting


📈 18.79 Punkte
🔧 Programmierung

🔧 Hosting Web Application For The Web


📈 18.42 Punkte
🔧 Programmierung

🔧 Deploy NodeJs Application On Ubuntu and Nginx


📈 18.09 Punkte
🔧 Programmierung

🔧 Hosting a Flask web server on Railway [FREE]


📈 17.93 Punkte
🔧 Programmierung

matomo