Learn how to deploy a Node.js app with Docker on AlmaLinux 10 step by step. Install Docker, configure Nginx reverse proxy, secure with Let’s Encrypt SSL.
Introduction
In this tutorial, we demonstrated how to deploy a Node.js application using Docker on AlmaLinux 10. We created a simple Hello World project, containerized it using a production-ready Dockerfile, configured Nginx as a reverse proxy, and secured the application with a free SSL certificate using Certbot.
This step-by-step guide is designed to help us deploy Node.js applications in a clean, modern, and secure way using containerization and HTTPS. The process follows current best practices and works reliably on AlmaLinux 10.
Prerequisites
Before we begin, let’s ensure we have the following in place:
- A AlmaLinux 10 dedicated server or KVM VPS.
- A basic programming knowledge.
- A domain name pointing to server IP.
Deploy Node.js App with Docker on AlmaLinux 10 (Nginx + SSL Guide)
Learn how to deploy a Node.js app with Docker on AlmaLinux 10 step by step. Install Docker, configure Nginx reverse proxy, secure with Let’s Encrypt SSL.
Introduction
In this tutorial, we demonstrated how to deploy a Node.js application using Docker on AlmaLinux 10. We created a simple Hello World project, containerized it using a production-ready Dockerfile, configured Nginx as a reverse proxy, and secured the application with a free SSL certificate using Certbot.
This step-by-step guide is designed to help us deploy Node.js applications in a clean, modern, and secure way using containerization and HTTPS. The process follows current best practices and works reliably on AlmaLinux 10.
Prerequisites
Before we begin, let’s ensure we have the following in place:
- A AlmaLinux 10 dedicated server or KVM VPS.
- A basic programming knowledge.
- A domain name pointing to server IP.
Deploy Node.js App with Docker on AlmaLinux 10 (Nginx + SSL Guide)
Step 1: Update the Server
First, we update our system packages to ensure everything is current.
sudo dnf update -y
Step 2: Install Docker on AlmaLinux 10
We install Docker from the official Docker repository.
Set up the repository
sudo dnf -y install dnf-plugins-core
sudo dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
Install the Docker packages
sudo dnf install docker-ce -y
Start Docker Engine:
sudo systemctl enable --now docker
To verify Docker is installed:
docker --version
Step 3: Create a Simple Hello World Node.js Application
Now we create a small Node.js project.
Create a new project directory:
mkdir node-docker-app
cd node-docker-app
Create a package.json file:
vi package.json
Add following content:
{
"name": "hello-node",
"version": "1.0.0",
"main": "index.js",
"scripts": {
"start": "node index.js"
},
"dependencies": {
"express": "^4.18.2"
}
}
Save and exit the file.
Now create the application file:
vi index.js
Add following content
const express = require("express");
const app = express();
app.get("/", (req, res) => {
res.send("Hello from our Dockerized Node.js app!");
});
app.listen(3000, () => {
console.log("Server running on port 3000");
});
Save and exit the file.
Step 4: Create the Dockerfile
Inside the same project directory, create a file named Dockerfile.
vi Dockerfile
Add the following content:
FROM node:24-alpine
WORKDIR /app
COPY package.json ./
RUN npm install --production
COPY . .
EXPOSE 3000
CMD ["node", "index.js"]
Save and exit the file.
This Dockerfile uses the Node.js 24 LTS image, installs dependencies, and starts the application.
Step 5: Build and Run the Docker Container
Build the Docker image:
docker build -t hello-node-app .
Run the container:
docker run -d -p 3000:3000 --name hello-node-container hello-node-app
Step 6: Install Nginx on AlmaLinux 10
Now we install Nginx to act as a reverse proxy.
sudo dnf install nginx -y
sudo systemctl enable --now nginx
Add HTTP and HTTPS ports in the firewall:
sudo firewall-cmd --add-port={80,443}/tcp --permanent
sudo firewall-cmd --reload
If you have enabled SELinux, execute following command:
sudo setsebool -P httpd_can_network_connect 1
Step 7: Configure Nginx Reverse Proxy
Create a new Nginx configuration file:
sudo vi /etc/nginx/conf.d/nodeapp.conf
Add this configuration (replace example.com with our domain):
server {
listen 80;
server_name example.com www.example.com;
location / {
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
Enable the configuration:
sudo nginx -t
sudo systemctl reload nginx
Step 8: Install Certbot and Enable HTTPS
AlmaLinux 10 uses Snap for Certbot installation.
Install Certbot:
sudo dnf install certbot python3-certbot-nginx -y
Now generate the SSL certificate:
sudo certbot --nginx -d example.com -d www.example.com
Follow the prompts and enter a valid email address.
After successful installation, our website will automatically be accessible over HTTPS.
Test automatic renewal:
sudo certbot renew --dry-run
Step 9: Access Application
Finally, navigate to your browser and access:
https://example.com
You will see:
Hello from our Dockerized Node.js app!
Step 10: How to Update the Node.js Project
When we update our Node.js project (for example, we modify index.js or install a new dependency), Docker will not automatically update the running container. We must rebuild the image and restart the container.
First, go to the project directory:
cd ~/node-docker-app
If we are pulling updates from Git:
git pull origin main
After the code is updated, rebuild the Docker image:
docker build -t hello-node-app .
Now stop and remove the old container:
docker stop hello-node-container
docker rm hello-node-container
Start a new container using the updated image:
docker run -d -p 3000:3000 --name hello-node-container hello-node-app
That’s it. The updated version of the project is now live.
Conclusion
We have successfully deployed a Dockerized Node.js application on AlmaLinux 10 and configured it with Nginx and HTTPS. This setup provides a stable and scalable foundation for running production applications.
By using Docker for application isolation, Nginx for traffic management, and Certbot for SSL security, we ensure that our deployment is secure, maintainable, and easy to update. This approach can be reused for future Node.js projects with minimal adjustments.

