Access Ghost Blog via subdirectory from 2 different servers with SSL

Hi All,
Need some help.
Disclaimer
I’ve already looked into Google and Ghost Forum regarding this and nothing seems to fit my needs and/or I can’t make it to work. Need some advice, another set of eyes to verify that my configuration is correct and/or do I need to make some adjustments.

Problem
Server 1 : www.domain1.com - hosted in Heroku
Server 2 (this is where Ghost is installed) : www.domain2.com - hosted in Digital Ocean

I want to access Ghost under www.domain1.com/blog. Below are my configs.

config.production.json (assume all items are filled)

{
“url”: “http://www.domain1.com/blog”,
“server”: {
“port”: 2368,
“host”: “127.0.0.1”
},
“database”: {
“client”: “mysql”,
“connection”: {
“host”: “localhost”,
“user”: “ghost”,
“password”: “”,
“database”: “ghost_production”
}
},
“mail”: {
“from”: “”,
“transport”: “”,
“options”: {
“service”: “”,
“host”: “”,
“port”: 587,
“auth”: {
“user”: “”,
“pass”: “”
}
}
},
“logging”: {
“transports”: [
“file”,
“stdout”
]
},
“process”: “systemd”,
“paths”: {
“contentPath”: “/var/www/ghost/content”
}
}

nginx

server {
listen 443 ssl http2;
listen [::]:443 ssl http2;

server_name domain2.com www.domain2.com;
root /var/www/ghost/system/nginx-root; # Used for acme.sh SSL verification (https://acme.sh)

ssl_certificate /etc/letsencrypt/www.domain2.com/fullchain.cer;
ssl_certificate_key /etc/letsencrypt/www.domain2.com/www.domain2.com.key;
include /etc/nginx/snippets/ssl-params.conf;

location ^~ /blog {
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header Host $http_host;
    proxy_pass http://127.0.0.1:2368;
    proxy_redirect off;
}

location ~ /.well-known {
    allow all;
}

client_max_body_size 50m;

}

Also, my application runs on Rails and is using reverse proxy to achieve this.

All help is appreciated.
Thanks in advance.

You can’t host one Ghost site on multiple websites, because Ghost requires a canonical url. Your url will either be domain1.com/blog or domain2.com, but it can’t be both. This will be used everywhere, from sitemaps to images to the link[rel="canonical"] tag

That being said, if you’d like to host your admin interface on a separate domain, that’s possible:

Cool, thanks for your reply.