Asset url issues with 2 VPS with nginx reverse proxy

Hi, im having a really hard time getting this to work…

I have 2 VPS:s, one with my main site running a scaled down WP install. And the other, running Ghost. I need them on two different vps:s for load balancing and ease of management reasons.

For easier explaination:
VPS 1: “Maindomain”
VPS 2: “Ghostdomain”

I have ghost on, and serve it to
The proxy works fine, but since ghost uses relative urls, none of the assets load.

I want one of three ways to solve this:

  1. Serve everything from Ex. maindomain-com/blog/assets/css.css

  2. Proxy everything to a different folder. Ex. maindomain-com/blog-assets/css.css

  3. Worst case scenario, host it from the other domain, like ghostdomain-com/assets/css.css.


Ghost VPS:
Ghost version: Latest
OS: Ubuntu 22.04
Nginx: 1.25.3
Node: 18.18.2
Database: MySQL 8

Main VPS:
OS: Debian 12
Nginx 1.25.3
For main site: Wordpres 6.2
Database: Mariadb 11.01
PHP 8.2

So I /think/ that what you want to do here is tell Ghost that it’s actually serving content from That should cause Ghost to tell the browser to ask for assets from, and then you just need to make sure your proxy knows to send those requests over to Ghost.

Yeah, i think that would be the best solution, but the problem is HOW i do that…

When i change the hostname in the ghost config, i only get “Error cannot get /”

Do you have your reverse proxy set up correctly?
Some examples (although they’re for Ghost Pro) are here: Using Ghost(Pro) with a subdirectory

I think so, as the proxy itself works. I get cannot get / on the ghostdomain too, so its probably a ghost config issue…

Heres my ghost config:

  "url": "ghostdomain-com",  
  "server": {
    "port": "PORT",
    "host": ""
  "database": {
    "client": "mysql",
    "connection": {
      "host": "",
      "user": "USER",
      "password": "PASSWORD",
      "database": "DATABASE"
  "mail": {
    "transport": "Direct"
  "logging": {
    "transports": [
  "process": "systemd",
  "paths": {
    "contentPath": "/PATHNAME/GHOSTDIR/content"

Reverse proxy setup from maindomain

 location /blogg/  {
         proxy_pass https://ghostdomain-com/;
       # proxy_set_header Host $http_host;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header X-Real-IP IPADRESS;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Scheme $scheme;

        client_max_body_size 50;
        proxy_ssl_server_name on;
        set_real_ip_from IPADRESS;
        real_ip_recursive on;

I would have expected the url (in the Ghost config file) to be - maybe that’s what you have but you anonymized it weirdly?

I have tested both, but it dosent change anything. Changed to /blog now to test - no differance…

But ive tought of something, the main problem really is that i have a assets folder on both the ghost site and my main, if i could change the name of the assets folder in ghost somehow i could just proxy that folder on the main site.

Like if i could change /assets and /public in ghost to /assets-blog and /public-blog


I got it working yesterday but dident have time to post an update.

Il post the solution as there will probably be more people facing similar issues.

When having my ghost url set to maindomain/blogg, i added a proxy_redirect to nginx like this:

  proxy_redirect https://ghostdomain-com/blogg/ /blogg/;

Now it correctly proxied the assets to /bogg/assets*

However, there was another issue.
There was a ip issue with my hosting provider, causing two of my VPS to have the same ip the day before. So i had to cancel one of the VPS:s and set it up again. I dident think about it at all, but the dns records wasent fully updated yet.

So because both VPS use Cloudflare, the reverse proxy for some reason caused CF error 1000. Even when i dident proxy any of the vps:s trough CF. Same with 502 errors, if i did anything wrong when setting up the proxy, it showed CF 502 error page even though CF proxy was turned off on both.

I did a nslookup and saw that the “new” VPS dident have its dns records fully upgraded, but it solved itself after a while.

So now everything is working!

The only “issue” right now is that for some reason the proxy_redirect is adding 600ms to the response time, or more correctly, the reponse time IS 600ms, but it could very well be my ghost theme that is not even closed to being optimized, getting about 50/100 pagespeed atm lol.