One app, multiple domains


#1

Hello astronauts,

I am developing an application with multiple sites in it.

For example connecting to janis.io should be http://IP/janis and kein.design be http://IP/kein-design

I know how to setup normal DNS for apache but never worked with nginx.

Can someone give me an idea how this could be realised?

I am using Ubuntu on my server


#2

Someone out there, who could help me?


#3

You use nginx as a front end, and set up multiple directives and each one points via “proxy_pass” to your running meteor app on a different port

something like this - I haven’t done it but I’ve read about it :slight_smile:

  location /janis {
    proxy_pass http://127.0.0.1:3000;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection 'upgrade';
    proxy_set_header X-Forwarded-For $remote_addr;
  }
  location /kein-design {
    proxy_pass http://127.0.0.1:3001;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection 'upgrade';
    proxy_set_header X-Forwarded-For $remote_addr;
  }


that post above might help… there they explain in the comments though that it might be easier for you to use multiple DNS names, instead of using one dns name and different url paths under it.

hope this gets you in the right direction.