How to Configure Nginx Reverse Proxy on AlmaLinux 10
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:
Start and enable Nginx:
---
Example Backend Service
For testing, assume you have a Node.js application running:
Example response:
---
Step 1. Create Nginx Configuration File
Create a new configuration file:
---
Step 2. Configure Reverse Proxy
Add the following configuration:
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:
If successful, you will see:
---
Step 4. Reload Nginx
Apply changes:
---
Step 5. Test Reverse Proxy
Open your browser:
Nginx will forward the request to your backend service (Node.js in this example).
---
Reverse Proxy Architecture
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
Proxy via Nginx:
---
### 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:
Or:
---
### Firewall Blocking Access
Allow HTTP traffic:
---
### SELinux Issues
If SELinux blocks proxy connections:
---
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
› How to Enable Gzip Compression in Nginx
› How to Configure Nginx FastCGI Cache for Better PHP Performance