Answer the question
In order to leave comments, you need to log in
How to setup multiple domains on vps hosting with nginx+gunicron for django?
There are several domains, each with its own site, I would like to have only one vps hosting for them (ubuntu 16). Now configured only for one, what needs to be added-changed?
Answer the question
In order to leave comments, you need to log in
Create another nginx virtual host config, change the domain in it to the desired one. save, restart nginx. So does gunicron.
Just create another upstream by specifying a different socket. And create another server block.
http {
upstream server1 {
server unix:///home/.../server1.sock;
}
upstream server2 {
server unix:///home/.../server2.sock;
}
server {
listen 80;
server_name server1.ru;
location / {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
uwsgi_pass server1;
include /etc/nginx/uwsgi_params;
}
}
server {
listen 80;
server_name server2.ru;
location / {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
uwsgi_pass server2;
include /etc/nginx/uwsgi_params;
}
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question