Self host multiple sites


I have a site, let’s call it, and want to host multiple vapid instances in the form:

Hosting a single instance reverse proxied (in Nginx) at is a piece of cake, but trying to expand that to run multiple sites on the same domain - or even a single instance in a sub-folder - has thus far been an exercise in futility.

I’ve been through a number of guides (e.g.‐hosting and even concocted a basic node.js server to test my reverse proxy configs. After which I’ve begun to wonder if Vapid isn’t doing something a little odd?

Basically reverse proxying at the root works fine, e.g.

location / {
    proxy_pass http://localhost:3000;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection 'upgrade';
    proxy_set_header Host $host;
    proxy_cache_bypass $http_upgrade;

but try as I might I can’t get it to work for locations like:

location /vapidsite01 {
    proxy_pass http://localhost:3001;
location /vapidsite02 {
    proxy_pass http://localhost:3002;

I can successfully browse to the individual instances (running with pm2) directly via the port, so I know they’re up and running ok. It’s just the reverse proxying that I seem to be having trouble with. I’ve tried many variations too, some with a trailing slash on proxy_pass, some with different proxy settings, etc. But I just seem to be making it fail in slightly different ways :slight_smile: - usually with a Vapid “Page Not Found” error, but sometimes with no images/css and sometimes with ending up at Basically if there’s a way to break it I’ve done it :laughing:

Does anyone have a similar setup successfully working, or have any ideas on what I might need to do to get it working?