0

I have a wordpress website example.com. I have a single domain SSL certificate that can be used across multiple servers.

When a user visits example.com, or any subfolder expect forum , they access server1 which is running apache.

When a user vists example.com/forum they are redirected to server2 which runs nginx. How would I set such that both ip addresses are mapped under example.com such that the redirects are only internal and the domain remains example.com at all times

In my site apache vhost, I am using

Redirect permanent /forum http://server2ip 

to redirect to server2

EDIT ACCORDING TO LUCA'S ANSWER TO SET server1 as PROXY to SERVER2

Here is my apache vhost config for the setup

VirtualHost *:80>
   RewriteEngine on
   ServerName example.com
   ServerAdmin me@example.com

   DocumentRoot /var/www/example

   #Redirect all HTTP requests to HTTPS
   # RewriteCond %{SERVER_PORT} 80
   # RewriteRule ^(.*)$ https://example.com/$1 [R=301,L]

   ProxyPass /forum https://server2ip/

   <Location /forum>
     ProxyPass https://server2ip/
     ProxyPassReverse https://server2ip/
   </Location>

   <Proxy *>
       Order allow,deny
       Allow from all
   </Proxy>

   ProxyHTMLEnable On
   ProxyHTMLURLMap https://server2ip/ /forum
</VirtualHost>
Mutuma
  • 111
  • 6

1 Answers1

1

You are actually redirecting the client to a different server. Assuming you configured DNS to point to server1, you want to mask the presence of server2. To do this configure apache as a reverse proxy and proxy /forum requests to server2. You do not need to configure SSL on server2.

Luca Corti
  • 171
  • 6