{"id":17910,"date":"2024-11-28T19:52:10","date_gmt":"2024-11-28T19:52:10","guid":{"rendered":"https:\/\/truehost.com\/support\/?post_type=docs&#038;p=17910"},"modified":"2024-11-28T19:52:41","modified_gmt":"2024-11-28T19:52:41","password":"","slug":"how-to-set-up-a-reverse-proxy-with-nginx-on-almalinux-9","status":"publish","type":"docs","link":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-set-up-a-reverse-proxy-with-nginx-on-almalinux-9\/","title":{"rendered":"How to Set Up a Reverse Proxy with Nginx on AlmaLinux 9"},"content":{"rendered":"\n<p>A reverse proxy acts as an intermediary server, directing client requests to backend servers while offering benefits like improved load balancing, security, and caching. NGINX, known for its performance and simplicity, is ideal for setting up a reverse proxy. This guide outlines the steps to configure it on\u00a0<strong>AlmaLinux 9<\/strong>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Prerequisites<\/strong><\/h3>\n\n\n\n<p>Before getting started, ensure you have:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>A server running\u00a0<strong>AlmaLinux 9<\/strong>\u00a0with\u00a0<strong>sudo<\/strong>\u00a0privileges.<\/li>\n\n\n\n<li><strong>NGINX installed<\/strong>\u00a0on the server.<\/li>\n\n\n\n<li>A domain name pointing to your server\u2019s IP address.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 1: Update System Packages<\/strong><\/h3>\n\n\n\n<p>Update your system to ensure all packages are up to date:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo dnf update -y<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 2: Install NGINX<\/strong><\/h3>\n\n\n\n<p>If NGINX isn\u2019t already installed, install it using the command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo dnf install nginx -y<\/code><\/pre>\n\n\n\n<p>Start and enable NGINX to run at boot:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo systemctl start nginx<br>sudo systemctl enable nginx<\/pre>\n\n\n\n<p>Check the installation by visiting your server&#8217;s IP in a browser (<code>http:\/\/&lt;server-ip><\/code>). You should see the default NGINX page.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 3: Configure NGINX as a Reverse Proxy<\/strong><\/h3>\n\n\n\n<p><strong>Create a Configuration File<\/strong>:<br>Add a new NGINX configuration file for your domain:bashCopy code<\/p>\n\n\n\n<ol class=\"wp-block-list\"><\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo nano \/etc\/nginx\/conf.d\/reverse-proxy.conf<\/code><\/pre>\n\n\n\n<p><strong>Set Up the Reverse Proxy Rules<\/strong>:<br>Add the following content to the file:<\/p>\n\n\n\n<p><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>server {\n    listen 80;\n    server_name example.com;\n\n    location \/ {\n        proxy_pass http:\/\/127.0.0.1:8080;\n        proxy_set_header Host $host;\n        proxy_set_header X-Real-IP $remote_addr;\n        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n    }\n}\n<\/code><\/pre>\n\n\n\n<p>Replace\u00a0<code>example.com<\/code>\u00a0with your domain name and\u00a0<code>http:\/\/127.0.0.1:8080<\/code>\u00a0with your backend service&#8217;s address and port.<\/p>\n\n\n\n<p><strong>Test the Configuration<\/strong>:<\/p>\n\n\n\n<p>Check for syntax errors:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo nginx -t<\/code><\/pre>\n\n\n\n<p><strong>Reload NGINX<\/strong>:<\/p>\n\n\n\n<p>Apply the configuration changes:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo systemctl reload nginx<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 4: Enable SSL for Secure Connections<\/strong><\/h3>\n\n\n\n<p><strong>nstall Certbot<\/strong>:<br>Certbot automates SSL certificate generation and renewal:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo dnf install certbot python3-certbot-nginx -y<\/code><\/pre>\n\n\n\n<p><strong>Obtain an SSL Certificate<\/strong>:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Run Certbot to secure your domain. Replace example.com with your actual domain name.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo certbot --nginx -d example.com -d www.example.com<\/code><\/pre>\n\n\n\n<p><strong>Verify SSL Setup<\/strong>:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>After successful completion, access your site using\u00a0<code>https:\/\/example.com<\/code>. Certbot automatically updates your NGINX configuration to redirect HTTP traffic to HTTPS.<\/li>\n<\/ul>\n\n\n\n<p><strong>Set Up Auto-Renewal<\/strong>:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Add a cron job for automatic certificate renewal:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>echo \"0 0 * * * certbot renew --quiet\" | sudo tee \/etc\/cron.d\/certbot-renew<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 5: Test the Reverse Proxy<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Use your domain name in a browser (<code>http:\/\/example.com<\/code>\u00a0or\u00a0<code>https:\/\/example.com<\/code>).<\/li>\n\n\n\n<li>Ensure requests are correctly forwarded to the backend service.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Key Benefits of Using a Reverse Proxy<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Security<\/strong>: Shields backend servers from direct exposure to the internet.<\/li>\n\n\n\n<li><strong>Load Balancing<\/strong>: Distributes traffic across multiple servers.<\/li>\n\n\n\n<li><strong>Caching<\/strong>: Stores static content to improve response times.<\/li>\n\n\n\n<li><strong>Flexibility<\/strong>: Centralizes and simplifies traffic routing.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>Setting up an NGINX reverse proxy on AlmaLinux 9 is a straightforward process that enhances your system\u2019s scalability and security. By adding SSL, you further secure communication between clients and servers, ensuring a robust and efficient infrastructure.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A reverse proxy acts as an intermediary server, directing client requests to backend servers while offering benefits like improved load balancing, security, and caching. NGINX, known for its performance and simplicity, is ideal for setting up a reverse proxy. This guide outlines the steps to configure it on\u00a0AlmaLinux 9. Prerequisites Before getting started, ensure you [&hellip;]<\/p>\n","protected":false},"author":9,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"_eb_attr":"","_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"doc_category":[1820,1824,1879,2128],"doc_tag":[],"class_list":["post-17910","docs","type-docs","status-publish","hentry","doc_category-cloud-servers-in-kenya","doc_category-dedicated-servers","doc_category-servers","doc_category-vps-servers"],"year_month":"2026-07","word_count":461,"total_views":"0","reactions":{"happy":"23","normal":"0","sad":"0"},"author_info":{"name":"Eugene","author_nicename":"eugene","author_url":"https:\/\/truehost.com\/support\/author\/eugene\/"},"doc_category_info":[{"term_name":"Cloud servers in Kenya","term_url":"https:\/\/truehost.com\/support\/docs-category\/cloud-servers-in-kenya\/"},{"term_name":"dedicated servers","term_url":"https:\/\/truehost.com\/support\/docs-category\/dedicated-servers\/"},{"term_name":"Servers","term_url":"https:\/\/truehost.com\/support\/docs-category\/servers\/"},{"term_name":"VPS-Servers","term_url":"https:\/\/truehost.com\/support\/docs-category\/vps-servers\/"}],"doc_tag_info":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.0 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Set Up a Reverse Proxy with Nginx on AlmaLinux 9 -<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/truehost.com\/support\/knowledge-base\/how-to-set-up-a-reverse-proxy-with-nginx-on-almalinux-9\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Set Up a Reverse Proxy with Nginx on AlmaLinux 9 -\" \/>\n<meta property=\"og:description\" content=\"A reverse proxy acts as an intermediary server, directing client requests to backend servers while offering benefits like improved load balancing, security, and caching. NGINX, known for its performance and simplicity, is ideal for setting up a reverse proxy. This guide outlines the steps to configure it on\u00a0AlmaLinux 9. Prerequisites Before getting started, ensure you [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/truehost.com\/support\/knowledge-base\/how-to-set-up-a-reverse-proxy-with-nginx-on-almalinux-9\/\" \/>\n<meta property=\"article:modified_time\" content=\"2024-11-28T19:52:41+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/knowledge-base\\\/how-to-set-up-a-reverse-proxy-with-nginx-on-almalinux-9\\\/\",\"url\":\"https:\\\/\\\/truehost.com\\\/support\\\/knowledge-base\\\/how-to-set-up-a-reverse-proxy-with-nginx-on-almalinux-9\\\/\",\"name\":\"How to Set Up a Reverse Proxy with Nginx on AlmaLinux 9 -\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/#website\"},\"datePublished\":\"2024-11-28T19:52:10+00:00\",\"dateModified\":\"2024-11-28T19:52:41+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/knowledge-base\\\/how-to-set-up-a-reverse-proxy-with-nginx-on-almalinux-9\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/truehost.com\\\/support\\\/knowledge-base\\\/how-to-set-up-a-reverse-proxy-with-nginx-on-almalinux-9\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/knowledge-base\\\/how-to-set-up-a-reverse-proxy-with-nginx-on-almalinux-9\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/truehost.com\\\/support\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Set Up a Reverse Proxy with Nginx on AlmaLinux 9\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/#website\",\"url\":\"https:\\\/\\\/truehost.com\\\/support\\\/\",\"name\":\"\",\"description\":\"Help In a Click\",\"publisher\":{\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/truehost.com\\\/support\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/#organization\",\"name\":\"Truehost Kenya\",\"url\":\"https:\\\/\\\/truehost.com\\\/support\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/truehost.com\\\/support\\\/wp-content\\\/uploads\\\/2026\\\/04\\\/cropped-image_2026-04-16_174808866.png\",\"contentUrl\":\"https:\\\/\\\/truehost.com\\\/support\\\/wp-content\\\/uploads\\\/2026\\\/04\\\/cropped-image_2026-04-16_174808866.png\",\"width\":240,\"height\":48,\"caption\":\"Truehost Kenya\"},\"image\":{\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/#\\\/schema\\\/logo\\\/image\\\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Set Up a Reverse Proxy with Nginx on AlmaLinux 9 -","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-set-up-a-reverse-proxy-with-nginx-on-almalinux-9\/","og_locale":"en_US","og_type":"article","og_title":"How to Set Up a Reverse Proxy with Nginx on AlmaLinux 9 -","og_description":"A reverse proxy acts as an intermediary server, directing client requests to backend servers while offering benefits like improved load balancing, security, and caching. NGINX, known for its performance and simplicity, is ideal for setting up a reverse proxy. This guide outlines the steps to configure it on\u00a0AlmaLinux 9. Prerequisites Before getting started, ensure you [&hellip;]","og_url":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-set-up-a-reverse-proxy-with-nginx-on-almalinux-9\/","article_modified_time":"2024-11-28T19:52:41+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-set-up-a-reverse-proxy-with-nginx-on-almalinux-9\/","url":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-set-up-a-reverse-proxy-with-nginx-on-almalinux-9\/","name":"How to Set Up a Reverse Proxy with Nginx on AlmaLinux 9 -","isPartOf":{"@id":"https:\/\/truehost.com\/support\/#website"},"datePublished":"2024-11-28T19:52:10+00:00","dateModified":"2024-11-28T19:52:41+00:00","breadcrumb":{"@id":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-set-up-a-reverse-proxy-with-nginx-on-almalinux-9\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/truehost.com\/support\/knowledge-base\/how-to-set-up-a-reverse-proxy-with-nginx-on-almalinux-9\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-set-up-a-reverse-proxy-with-nginx-on-almalinux-9\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/truehost.com\/support\/"},{"@type":"ListItem","position":2,"name":"How to Set Up a Reverse Proxy with Nginx on AlmaLinux 9"}]},{"@type":"WebSite","@id":"https:\/\/truehost.com\/support\/#website","url":"https:\/\/truehost.com\/support\/","name":"","description":"Help In a Click","publisher":{"@id":"https:\/\/truehost.com\/support\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/truehost.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/truehost.com\/support\/#organization","name":"Truehost Kenya","url":"https:\/\/truehost.com\/support\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/truehost.com\/support\/#\/schema\/logo\/image\/","url":"https:\/\/truehost.com\/support\/wp-content\/uploads\/2026\/04\/cropped-image_2026-04-16_174808866.png","contentUrl":"https:\/\/truehost.com\/support\/wp-content\/uploads\/2026\/04\/cropped-image_2026-04-16_174808866.png","width":240,"height":48,"caption":"Truehost Kenya"},"image":{"@id":"https:\/\/truehost.com\/support\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/docs\/17910","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/comments?post=17910"}],"version-history":[{"count":2,"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/docs\/17910\/revisions"}],"predecessor-version":[{"id":17912,"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/docs\/17910\/revisions\/17912"}],"wp:attachment":[{"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/media?parent=17910"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/doc_category?post=17910"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/doc_tag?post=17910"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}