php WordPress背后的NGINX SSL反向代理

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php WordPress背后的NGINX SSL反向代理相关的知识,希望对你有一定的参考价值。

// If nginx
//etc/nginx/conf.d/ssl.conf

location /blog/ {
  proxy_pass http://backend:8081/;
  proxy_set_header X-Forwarded-Host $host;
  proxy_set_header X-Forwarded-Proto $scheme;
}
/**
 * Handle SSL reverse proxy
 * Add this
 */
if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')
    $_SERVER['HTTPS']='on';

if (isset($_SERVER['HTTP_X_FORWARDED_HOST'])) {
    $_SERVER['HTTP_HOST'] = $_SERVER['HTTP_X_FORWARDED_HOST'];
}

// If the URI on the proxy is different than the URI on the backend,
// add this to wp-config.php too where “/blog” is the URI prefix on the proxy
$_SERVER['REQUEST_URI'] = "/blog".$_SERVER['REQUEST_URI'];

以上是关于php WordPress背后的NGINX SSL反向代理的主要内容,如果未能解决你的问题,请参考以下文章

Nginx 代理背后的 SSL SpringBoot App Docker 容器

带有ssl的nginx代理后面的docker容器内的Wordpress

Nginx配置https的wordpress站点,wp-content目录下资源404解决方案

php wordpress ssl

php wordpress SSL重定向错误

php 在WordPress中的页面上强制SSL