{"id":17913,"date":"2024-11-28T20:05:30","date_gmt":"2024-11-28T20:05:30","guid":{"rendered":"https:\/\/truehost.com\/support\/?post_type=docs&#038;p=17913"},"modified":"2025-04-09T15:09:41","modified_gmt":"2025-04-09T15:09:41","password":"","slug":"how-to-configure-apache-as-a-reverse-proxy-with-mod_proxy","status":"publish","type":"docs","link":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-configure-apache-as-a-reverse-proxy-with-mod_proxy\/","title":{"rendered":"How to Configure Apache as a Reverse Proxy with mod_proxy"},"content":{"rendered":"\n<p>Apache is a powerful and versatile web server that can also act as a reverse proxy, forwarding client requests to backend servers. Setting up Apache as a reverse proxy enhances security, simplifies client access to multiple services, and improves load balancing. Here\u2019s a simplified guide to configure Apache as a reverse proxy using the\u00a0<strong>mod_proxy<\/strong>\u00a0module.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>What You\u2019ll Need<\/strong><\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>A fresh Linux server (e.g., Ubuntu 20.04) with Apache installed.<\/li>\n\n\n\n<li>A DNS \u201cA\u201d record pointing to your server&#8217;s IP (e.g.,\u00a0<code>app.example.com<\/code>).<\/li>\n\n\n\n<li>Docker installed to host backend applications like ownCloud.<\/li>\n\n\n\n<li>A non-root user with sudo privileges.<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 1: Enable Required Modules<\/strong><\/h3>\n\n\n\n<p>Apache uses several modules for reverse proxying. Start by enabling these:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo a2enmod proxy\nsudo a2enmod proxy_http\nsudo a2enmod proxy_balancer\nsudo a2enmod proxy_wstunnel<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>mod_proxy<\/strong>: Core proxying functionality.<\/li>\n\n\n\n<li><strong>proxy_http<\/strong>: Handles HTTP\/HTTPS requests.<\/li>\n\n\n\n<li><strong>proxy_balancer<\/strong>: Adds load-balancing capabilities.<\/li>\n\n\n\n<li><strong>proxy_wstunnel<\/strong>: Facilitates WebSocket tunneling.<\/li>\n<\/ul>\n\n\n\n<p>Restart Apache to apply changes:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo systemctl restart apache2<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 2: Set Up a Backend Application<\/strong><\/h3>\n\n\n\n<p>For this example, we\u2019ll use ownCloud hosted in a Docker container:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker run -d --name owncloud -p 8080:8080 owncloud\/server\ndocker start owncloud\n<\/code><\/pre>\n\n\n\n<p>Verify that ownCloud is running:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">docker ps<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 3: Configure Apache as a Reverse Proxy<\/strong><\/h3>\n\n\n\n<p><strong>Back Up the Default Configuration<\/strong>:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo mv \/etc\/apache2\/sites-available\/000-default.conf \/etc\/apache2\/sites-available\/origdefault.backup<\/code><\/pre>\n\n\n\n<p><strong>Create a New Configuration File<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo nano \/etc\/apache2\/sites-available\/app.example.com.conf<\/pre>\n\n\n\n<p>Add the following content, replacing&nbsp;<code>app.example.com<\/code>&nbsp;with your domain:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">&lt;VirtualHost *:80><br>    ServerName app.example.com<br>    ProxyPreserveHost On<br>    ProxyPass \/ http:\/\/127.0.0.1:8080\/<br>    ProxyPassReverse \/ http:\/\/127.0.0.1:8080\/<br>&lt;\/VirtualHost><br><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>ProxyPreserveHost<\/strong>: Forwards the original host header to the backend.<\/li>\n\n\n\n<li><strong>ProxyPass<\/strong>: Routes client requests to the backend server.<\/li>\n\n\n\n<li><strong>ProxyPassReverse<\/strong>: Adjusts response headers from the backend.<\/li>\n<\/ul>\n\n\n\n<p><strong>Activate the Configuration<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo ln -s \/etc\/apache2\/sites-available\/app.example.com.conf \/etc\/apache2\/sites-enabled\/app.example.com.conf<\/pre>\n\n\n\n<p><strong>Test and Restart Apache<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo apachectl configtest<br>sudo systemctl restart apache2<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 4: Secure the Server<\/strong><\/h3>\n\n\n\n<p>Allow HTTP and HTTPS traffic:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo ufw allow 80\/tcp<br>sudo ufw allow 443\/tcp<br>sudo ufw reload<\/pre>\n\n\n\n<p>Install SSL certificates for secure connections:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo apt install certbot python3-certbot-apache<br><br>sudo certbot -d app.example.com<\/pre>\n\n\n\n<p>Test automatic SSL renewal:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo certbot renew --dry-run<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 5: Verify the Setup<\/strong><\/h3>\n\n\n\n<p>Open a browser and navigate to&nbsp;<code>https:\/\/app.example.com<\/code>. If everything is configured correctly, you\u2019ll see the backend application&#8217;s interface (e.g., ownCloud login page).<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Benefits of Using Apache as a Reverse Proxy<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Improved Security<\/strong>: Shields backend servers from direct exposure.<\/li>\n\n\n\n<li><strong>Centralized Access<\/strong>: Simplifies client access to multiple services.<\/li>\n\n\n\n<li><strong>Load Balancing<\/strong>: Distributes traffic effectively.<\/li>\n\n\n\n<li><strong>Flexibility<\/strong>: Supports various backend applications.<\/li>\n<\/ul>\n\n\n\n<p>By following these steps, you\u2019ve successfully set up Apache as a reverse proxy with&nbsp;<strong>mod_proxy<\/strong>, providing a robust and secure infrastructure for your applications.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Apache is a powerful and versatile web server that can also act as a reverse proxy, forwarding client requests to backend servers. Setting up Apache as a reverse proxy enhances security, simplifies client access to multiple services, and improves load balancing. Here\u2019s a simplified guide to configure Apache as a reverse proxy using the\u00a0mod_proxy\u00a0module. What [&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,2140,1879,2128],"doc_tag":[],"class_list":["post-17913","docs","type-docs","status-publish","hentry","doc_category-cloud-servers-in-kenya","doc_category-dedicated-servers","doc_category-dns","doc_category-servers","doc_category-vps-servers"],"year_month":"2026-06","word_count":455,"total_views":"0","reactions":{"happy":"25","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":"DNS","term_url":"https:\/\/truehost.com\/support\/docs-category\/dns\/"},{"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 v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Configure Apache as a Reverse Proxy with mod_proxy -<\/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:\/\/www.truehost.com\/support\/knowledge-base\/how-to-configure-apache-as-a-reverse-proxy-with-mod_proxy\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Configure Apache as a Reverse Proxy with mod_proxy -\" \/>\n<meta property=\"og:description\" content=\"Apache is a powerful and versatile web server that can also act as a reverse proxy, forwarding client requests to backend servers. Setting up Apache as a reverse proxy enhances security, simplifies client access to multiple services, and improves load balancing. Here\u2019s a simplified guide to configure Apache as a reverse proxy using the\u00a0mod_proxy\u00a0module. What [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.truehost.com\/support\/knowledge-base\/how-to-configure-apache-as-a-reverse-proxy-with-mod_proxy\/\" \/>\n<meta property=\"article:modified_time\" content=\"2025-04-09T15:09: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:\\\/\\\/www.truehost.com\\\/support\\\/knowledge-base\\\/how-to-configure-apache-as-a-reverse-proxy-with-mod_proxy\\\/\",\"url\":\"https:\\\/\\\/www.truehost.com\\\/support\\\/knowledge-base\\\/how-to-configure-apache-as-a-reverse-proxy-with-mod_proxy\\\/\",\"name\":\"How to Configure Apache as a Reverse Proxy with mod_proxy -\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/#website\"},\"datePublished\":\"2024-11-28T20:05:30+00:00\",\"dateModified\":\"2025-04-09T15:09:41+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.truehost.com\\\/support\\\/knowledge-base\\\/how-to-configure-apache-as-a-reverse-proxy-with-mod_proxy\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.truehost.com\\\/support\\\/knowledge-base\\\/how-to-configure-apache-as-a-reverse-proxy-with-mod_proxy\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.truehost.com\\\/support\\\/knowledge-base\\\/how-to-configure-apache-as-a-reverse-proxy-with-mod_proxy\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/truehost.com\\\/support\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Configure Apache as a Reverse Proxy with mod_proxy\"}]},{\"@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 Configure Apache as a Reverse Proxy with mod_proxy -","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:\/\/www.truehost.com\/support\/knowledge-base\/how-to-configure-apache-as-a-reverse-proxy-with-mod_proxy\/","og_locale":"en_US","og_type":"article","og_title":"How to Configure Apache as a Reverse Proxy with mod_proxy -","og_description":"Apache is a powerful and versatile web server that can also act as a reverse proxy, forwarding client requests to backend servers. Setting up Apache as a reverse proxy enhances security, simplifies client access to multiple services, and improves load balancing. Here\u2019s a simplified guide to configure Apache as a reverse proxy using the\u00a0mod_proxy\u00a0module. What [&hellip;]","og_url":"https:\/\/www.truehost.com\/support\/knowledge-base\/how-to-configure-apache-as-a-reverse-proxy-with-mod_proxy\/","article_modified_time":"2025-04-09T15:09: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:\/\/www.truehost.com\/support\/knowledge-base\/how-to-configure-apache-as-a-reverse-proxy-with-mod_proxy\/","url":"https:\/\/www.truehost.com\/support\/knowledge-base\/how-to-configure-apache-as-a-reverse-proxy-with-mod_proxy\/","name":"How to Configure Apache as a Reverse Proxy with mod_proxy -","isPartOf":{"@id":"https:\/\/truehost.com\/support\/#website"},"datePublished":"2024-11-28T20:05:30+00:00","dateModified":"2025-04-09T15:09:41+00:00","breadcrumb":{"@id":"https:\/\/www.truehost.com\/support\/knowledge-base\/how-to-configure-apache-as-a-reverse-proxy-with-mod_proxy\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.truehost.com\/support\/knowledge-base\/how-to-configure-apache-as-a-reverse-proxy-with-mod_proxy\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.truehost.com\/support\/knowledge-base\/how-to-configure-apache-as-a-reverse-proxy-with-mod_proxy\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/truehost.com\/support\/"},{"@type":"ListItem","position":2,"name":"How to Configure Apache as a Reverse Proxy with mod_proxy"}]},{"@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\/17913","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=17913"}],"version-history":[{"count":1,"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/docs\/17913\/revisions"}],"predecessor-version":[{"id":17914,"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/docs\/17913\/revisions\/17914"}],"wp:attachment":[{"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/media?parent=17913"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/doc_category?post=17913"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/doc_tag?post=17913"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}