Menu
User

DropVPS Team

Writer: John hens

how to install nginx reverse proxy on redhat 9/8

how to install nginx reverse proxy on redhat 9/8

Publication Date

10/11/2025

Category

Articles

Reading Time

2 Min

Table of Contents

A reverse proxy helps you manage incoming web traffic and forward it to backend servers. Using Nginx as a reverse proxy on Red Hat 8 or 9 improves security, load balancing, and performance.

Step 1: Update the System

Before installing Nginx, update your system to ensure all packages are current

sudo dnf update -y

Step 2: Install Nginx

Nginx is available in the official Red Hat repositories. You can install it easily using DNF.

sudo dnf install nginx -y

After installation, start and enable the service.

sudo systemctl start nginx
sudo systemctl enable nginx

Step 3: Configure Nginx as a Reverse Proxy

Nginx works as a reverse proxy by forwarding client requests to backend servers, improving performance and protecting your server from direct access.

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

Add the configuration below (replace the backend server IP or domain):

server {
    listen 80;
    server_name yourdomain.com;

    location / {
        proxy_pass http://127.0.0.1:8080;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

Step 4: Adjust Firewall Settings

If the firewall is active, allow HTTP traffic so users can access the reverse proxy.

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

Step 5: Test the Reverse Proxy

After configuring Nginx, it’s important to test if the reverse proxy is working correctly by sending a request to your domain or server IP.

curl -I http://yourdomain.com

 

Linux VPS
U
Loading...

Related Posts