4👍
You’re looking for the nginx HttpProxyModule I believe.
You define a upstream in nginx
upstream webservers {
server 12.34.567.12:8000;
server 21.43.765.21:8000;
}
And then forward requests via proxy_pass to the upstream.
server {
listen 443; //Port you want nginx to listen on
location / {
proxy_set_header Host $http_host;
proxy_read_timeout 330;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://webservers ;
}
}
And unless I’m mistaken the HttpProxyModule buffers the entire request before passing it on.
This may break some items that require streaming or interaction during this process but that’s a limit you face.
My nginx is a bit rusty so it might not work but it should be something along these lines
1👍
You definitely want nginx sitting in front of gunicorn. It is a common setup and you can find a lot of resources to help you get started. I like this tutorial: http://senko.net/en/django-nginx-gunicorn/, which will also walk you through supervisord and setting up a virtualenv.
- [Django]-How to generate unique 8 length number, for account ID for example (Python,Django)
- [Django]-How to update a single field in a model using UpdateAPIView from Djangorestframework?
- [Django]-Django restful API – get user id with token
0👍
If your looking to host on EC2 with Ubuntu server than these are some good tutorials apart from the one mentioned by Nathan.
- http://ijcdigital.com/blog/django-gunicorn-and-nginx-setup/
This one is setting up Nginx and Gunicorn in Ubuntu. - http://ydevel.tumblr.com/post/22850778860/configuring-an-https-site-with-django-on-nginx
This one is for setting up with Https Configurations also. - http://adrian.org.ar/automatic-setup-of-django-nginx-and-gunicorn-on-ec2/ This one is quite interesting because it explains How to install Nginx with Gunicorn in EC2 using Bellatrix(a nice library over boto). Do go through this one atleast once. Its very good
Best Of Luck with your deployment. If you find the answer helpful do accept the answer
- [Django]-Linking directly to Wagtail modeladmin views
- [Django]-What is a main reason that Django webserver is blocking?
- [Django]-Populate() isn't reentrant Django Google App Engine
- [Django]-Executing tasks with celery at periodic schedule