WordPress behind an nginx SSL reverse proxy

/etc/nginx/conf.d/ssl.conf (inside the ssl server block)

location /blog/ {
  proxy_pass http://backend:8081/;
  proxy_set_header X-Forwarded-Host $host;
  proxy_set_header X-Forwarded-Proto $scheme;

Add this to wp-config.php

 * Handle SSL reverse proxy
if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')


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