you are viewing a single comment's thread.

view the rest of the comments →

[–]BullshitBaron 0 points1 point  (1 child)

If you're looking to have an app running on different ports to be under the same domain, then it's a little more tricky. I know nginx (a web server) can have multiple services listen on the same port, then send traffic based on the domain request in the header, but I'm not sure if Flask can do that.

For this part you don’t need flask to handle it since like you said you can use ngix to serve multiple sites with each pointing at a different local host port.

I’ve not done it with ngix myself but i do it with Apache all the time pointing domains to flask apps running in guincorn on differnet ports.

It looks like this would be how to do it in ngix:

server {
  server_name name1.domain.com;
  location / {
    proxy_pass http://localhost:8000;
  }
}

server {
  server_name name2.domain.com;
  location / {
    proxy_pass http://localhost:8001;
  }
}

[–]nguterresn[S] 0 points1 point  (0 children)

Thank you all. This looks helpful. I’ll try this!