Want to run the same Python app in multiple domains

Asked 2 years ago, Updated 2 years ago, 51 views

I'm wondering how to set up a Python publishing setting for a virtual hosted site like *.tumblr.com, such as tumblr

This is the minimum configuration for nginx when using gunicorn on a single domain site.

 location/{
   proxy_pass:http://localhost:8000/
}

However, when running multisite using virtual hosts on nginx, moving the gunicorn first was a bottleneck, and when there were 100 sites, our stackoverflow answered that it would launch 100 gunicorn processes.Each site has a nginx configuration file and a launch script for gunicorn.I'm not sure...

https://stackoverflow.com/questions/3756934/running-multiple-sites-with-djangos-sites-framework-through-gunicorn-nginx/5358948#5358948

It seems difficult to move multi-domain with gunicorn.

What kind of server configuration should I use to run the same Python app in multiple domains?

I was able to check the operation myself.

http://aroundthedistance.hatenadiary.jp/entry/2015/01/15/234259 to write how to do it

python nginx

2022-09-30 16:40

1 Answers

If the backend program is configured to distribute sites according to the domain, you should be able to use the same configuration file as in a single domain without considering load balancing.

If server_name is set correctly even if there is a virtual domain used for other programs or static sites, it will be allocated.
However, this only assumes that the configuration is assigned according to the domain accessed by the program by invoking the same program.You should also remember to pass the HOST in proxy_set_header as shown in the reference link.I've never used gunicorn, so I don't know the details...

(When I reread the reference link, did you say *~ each uses a different configuration file and loads it into memory, so I can't do it with the same process *?)If that's the case, it might be right...…)

In terms of how the reverse proxy works, there should be no problem with the order in which gunicorn and Nginx start up.


2022-09-30 16:40

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.