Installing a second Ghost as subdirectory on Serverpilot

Related to this post: Ghost as a sub directory using NGINX

First of all Serverpilot has a different setup so there is no /etc/nginx/sites-enabled/instead you have something like this: /etc/nginx-sp/vhosts.d/ghost.d/ where “ghost.d” is the directory corresponding is the Serverpilot .d I’ve created.

I’m aiming to create a new file called devnull.conf in that folder with this content

    location ^~ /devnull/ {
        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_set_header X-NginX-Proxy true;

        proxy_pass http://127.0.0.1:2369;
        proxy_redirect off;
    } 

NOTE:
My first blog is in https://blikonsult.se and runs Ghost on 2368
My second blog will be in https://blikonsult.se/devnull/ and runs Ghost on 2369

Which will end up in the server {} tag due to how Serverpilot:
include conf file include /etc/nginx-sp/vhosts.d/ghost.d/*.conf;

  1. I’m I doing things right? Do I have to do anything in .htaccess?
  2. This might help people in future and the previous issue was closed.

Part of the solution is super simple:

    location /devnull/ {
        proxy_pass $backend_protocol://$backend_host:2369;
    }

Unfortunately https://blikonsult/devnull/ghost redirects me to https://blikonsult/ghost so I cannot access the admin control of my second blog.

NOTE: Note the portnumber of my second blog is 2369. I named my file zdevnull.conf so that it is included after main.conf which is managed by Serverpilot.

This is my solution:

location ^~ /devnull/ {
    proxy_pass $backend_protocol://$backend_host:2369;
    root /srv/users/ghost/apps/ghost/public/devnull;
}

I added root directive and the correct path and now things work.