架构 ingress ----> apache2-php-fpm+wordpres
mix-content 问题
ingress https 协议 转发到 wordpress http 协议时 访问出现mix-content 问题需要如下配置
location /blog/ {
port_in_redirect off;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_pass http://10.1.2.3/;
}
location = /blog {
port_in_redirect off;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_pass http://10.1.2.3/;
}
编辑wordpress wp-config.conf 文件
//Begin Really Simple SSL Load balancing fix
if ((isset($_ENV["HTTPS"]) && ("on" == $_ENV["HTTPS"]))
|| (isset($_SERVER["HTTP_X_FORWARDED_SSL"]) && (strpos($_SERVER["HTTP_X_FORWARDED_SSL"], "1") !== false))
|| (isset($_SERVER["HTTP_X_FORWARDED_SSL"]) && (strpos($_SERVER["HTTP_X_FORWARDED_SSL"], "on") !== false))
|| (isset($_SERVER["HTTP_CF_VISITOR"]) && (strpos($_SERVER["HTTP_CF_VISITOR"], "https") !== false))
|| (isset($_SERVER["HTTP_CLOUDFRONT_FORWARDED_PROTO"]) && (strpos($_SERVER["HTTP_CLOUDFRONT_FORWARDED_PROTO"], "https") !== false))
|| (isset($_SERVER["HTTP_X_FORWARDED_PROTO"]) && (strpos($_SERVER["HTTP_X_FORWARDED_PROTO"], "https") !== false))
|| (isset($_SERVER["HTTP_X_PROTO"]) && (strpos($_SERVER["HTTP_X_PROTO"], "SSL") !== false))
) {
$_SERVER["HTTPS"] = "on";
}
//END Really Simple SSL
#以上配置借鉴与Really Simple SSL plugin
子目录问题
我在 docker 容器中设置了我的 wordpress,使用 nginx 反向代理将所有位置请求转发/blog到该 docker 容器。
问题是登录 wp-admin 后,它重定向到domain/wp-admin/而不是/domain/blog/wp-admin.
编辑wordpress wp-config.conf 文件 确保访问路径和wpconfig 同步
$_SERVER['REQUEST_URI'] = '/blog' . $_SERVER['REQUEST_URI'];
标签:set,HTTP,FORWARDED,部署,SERVER,问题,header,wordpress,proxy
From: https://www.cnblogs.com/leleyao/p/17125831.html