[英]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)中,我必須同時更新siteurl
和home
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.