繁体   English   中英

Wordpress 反向代理

[英]Wordpress Reverse Proxy

我正在尝试将 example.com 反向代理到 production.example.com,它位于不同的服务器上。 但是,在主域上添加代理规则(apache)并在 production.example.com wp-config.php 上添加以下内容后

define( 'WP_SITEURL', "https://example.com/" );

我能够毫无问题地加载该网站。 但是,当我尝试单击帖子时,该帖子会从 production.example.com 加载

Example : https://production.example.com/hello-world/

我该如何解决这个问题,让网站改为在 siteurl 上加载。

考虑到 example.com 是您的外部域。

在数据库(或直接 ui)中,我必须同时更新siteurlhome

update wp_options set option_value="https://example.com" where option_name in ("siteurl", "home");

还粘贴 apache 的反向代理设置:

<VirtualHost *:443>
  ServerName example.com
  SSLEngine on
  SSLCertificateFile "/sslcert/server.crt"
  SSLCertificateKeyFile "/sslcert/server.key"

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

   # These are required for https reverse proxy to work   
   RequestHeader set X-Forwarded-Proto "https"
   RequestHeader set X-Forwarded-Port "443"   

   ProxyPass / http://non-public-address/
   ProxyPassReverse / http://non-public-address/
   ProxyPreserveHost On
   ErrorLog "logs/wordpress.revproxy-sslerror_log"
   CustomLog "logs/wordpress.revproxy-sslaccess_log" common
</VirtualHost>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM