How to Setup a Reverse Proxy With Apache HTTP Server on AlmaLinux 8

Let’s assume, we want to make the example.com server sit in front of the localhost:8080 server.

a) Creating Virtual Host

Open the /etc/httpd/conf.d/sites.conf file on your favorite text editor with superuser privileges and add the lines below.

<VirtualHost *:80>
    ServerName example.com

    ProxyPreserveHost On
    ProxyPass / http://localhost:8080/
    ProxyPassReverse / http://localhost:8080/
</VirtualHost>

b) Restarting

Restart the httpd service.
sudo systemctl restart httpd.service


Documentations

Abdullah As-Sadeed
Abdullah As-Sadeed

Prefers coding from scratch. Loves the Linux kernel.

Leave a Reply