How to Configure Nginx Reverse Proxy on AlmaLinux 10

Published: 2026-06-28
Google AdSense 广告位 (待申请通过后开启)

A reverse proxy is a server that sits between clients and backend services. It forwards client requests to backend applications such as Node.js, Java, or PHP services, and then returns the response to the client.

Nginx is one of the most popular reverse proxy servers due to its performance, stability, and ease of configuration.

This guide explains how to configure Nginx as a reverse proxy on AlmaLinux 10.

---

Prerequisites

Before starting, make sure:

* Nginx is installed

* You have sudo privileges

* A backend service is running (for example Node.js on port 3000)

Check Nginx version:

nginx -v

Start and enable Nginx:

sudo systemctl enable nginx
sudo systemctl start nginx

---

Example Backend Service

For testing, assume you have a Node.js application running:

http://127.0.0.1:3000

Example response:

Hello from Node.js

---

Step 1. Create Nginx Configuration File

Create a new configuration file:

sudo nano /etc/nginx/conf.d/reverse-proxy.conf

---

Step 2. Configure Reverse Proxy

Add the following configuration:

server {
    listen 80;
    server_name your-domain.com;

    location / {
        proxy_pass http://127.0.0.1:3000;
        proxy_http_version 1.1;

        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $host;

        proxy_cache_bypass $http_upgrade;
    }
}

Replace:

* `your-domain.com` with your real domain

* `127.0.0.1:3000` with your backend service address

---

Step 3. Test Nginx Configuration

Check configuration syntax:

sudo nginx -t

If successful, you will see:

syntax is ok
test is successful

---

Step 4. Reload Nginx

Apply changes:

sudo systemctl reload nginx

---

Step 5. Test Reverse Proxy

Open your browser:

http://your-domain.com

Nginx will forward the request to your backend service (Node.js in this example).

---

Reverse Proxy Architecture

Client → Nginx → Backend Service (Node.js / Java / PHP)

Nginx acts as a middle layer between users and your application.

---

Common Use Cases

### 1. Node.js Applications

Run Node.js on port 3000 and expose it via port 80.

---

### 2. Java Spring Boot Applications

http://127.0.0.1:8080

Proxy via Nginx:

proxy_pass http://127.0.0.1:8080;

---

### 3. PHP-FPM Applications

Nginx forwards requests to PHP backend using FastCGI.

---

Common Issues

### 502 Bad Gateway

This usually means backend service is not running.

Check:

ps aux | grep node

Or:

systemctl status nginx

---

### Firewall Blocking Access

Allow HTTP traffic:

sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --reload

---

### SELinux Issues

If SELinux blocks proxy connections:

sudo setsebool -P httpd_can_network_connect 1

---

Performance Tips

* Enable gzip compression

* Use caching for static files

* Use HTTP/2 if HTTPS is enabled

* Keep backend services on localhost for security

---

Conclusion

Nginx reverse proxy is a core component in modern web infrastructure. It allows you to securely expose backend services such as Node.js, Java, and PHP applications to the internet while improving performance, security, and scalability.

Once configured, you can easily build production-ready environments on AlmaLinux 10 using Nginx as the entry point for all traffic.

Explore More

Technology Guides →

How to Enable Gzip Compression in Nginx

How to Configure Nginx FastCGI Cache for Better PHP Performance

How to Install Nginx on AlmaLinux 10

Southeast Asia Insights →