Blog WordPress por trás do aplicativo Rails usando proxy reverso Nginx

Configurar blog em subdomínio

blog.domain.com

Defina constantes WP em wp-config.php

$_SERVER['HTTPS'] = 'on';
define
('WP_HOME', "https://www.domain.com/blog");
define
('WP_SITEURL', "https://www.domain.com/blog");

Configurar senha de proxy Nginx

location /blog {
proxy_pass http
://blog.domain.com;
proxy_http_version
1.1;
proxy_set_header
Connection "";
proxy_set_header
Host $host;
proxy_set_header X
-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X
-Real-IP $remote_addr;
}

Uma configuração alternativa:

location /blog {
proxy_set_header X
-Real-IP $remote_addr;
proxy_set_header X
-Forwarded-For $proxy_add_x_forwarded_for;
#proxy_set_header Host $http_host;
proxy_redirect
false;

if (!-f $request_filename) {
rewrite
^/blog$ /;
rewrite
^/blog/(.*)$ /$1;
proxy_pass http
://blog.domain.com;
break;
}
}