我有一个wordpress网站example.com 。 我有一个可以跨多个服务器使用的域SSL证书。
当用户访问example.com或任何子文件夹期望论坛时,他们访问运行apache的server1 。
当用户访问example.com/forum时,他们被redirect到运行nginx的server2 。 我将如何设置这两个IP地址映射在example.com下,使得redirect只是内部的,并且域始终保持example.com
在我的网站apache虚拟主机,我正在使用
Redirect permanent /forum http://server2ip
redirect到server2
编辑根据卢卡的答案将server1设置为PROXY到SERVER2
这里是我的apache虚拟主机configuration的设置
VirtualHost *:80> RewriteEngine on ServerName example.com ServerAdmin [email protected] 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>
您实际上是将客户端redirect到另一台服务器。 假设您将DNSconfiguration为指向server1 , server2掩盖server2的存在。 为此,请将apacheconfiguration为反向代理,并将代理/forum请求configuration为server2 。 您不需要在server2上configurationSSL 。