services:
app1:
command: python wsgi_docker.py
app2:
command: python wsgi_docker.py
app3:
command: python wsgi_docker.py
nginx:
ports:
- 80:95
- 443:96
server {
listen 96 ssl;
server_name my_domain.ru www.my_domain.ru;
ssl_certificate fullchain.pem;
ssl_certificate_key privkey.pem;
location /app1 {
proxy_pass "http://app1:8095/";
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
}
location /app2 {
proxy_pass "http://app2:8095/";
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
}
location /app3 {
proxy_pass "http://app3:8095/";
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
}
}
location / {
include uwsgi_params;
uwsgi_pass app:8095;
}
server {
listen 96 ssl;
server_name my_domain.ru www.my_domain.ru;
ssl_certificate fullchain.pem;
ssl_certificate_key privkey.pem;
location / {
proxy_pass "http://app:8095/";
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
}
}
services:
app:
command: python wsgi_docker.py
nginx:
ports:
- 80:95
- 443:96
depends_on:
- app
app.run(host='0.0.0.0', port=8095, debug=False)
services:
app:
command: python wsgi_docker.py
nginx:
ports:
- 95:80
- 96:443
depends_on:
- app
server {
listen 95;
...
return 301 https://$host$request_uri;
}
server {
listen 96 ssl;
ssl_certificate fullchain.pem;
ssl_certificate_key privkey.pem;
location / {
include uwsgi_params;
uwsgi_pass app:8095;
}
}
Стучаться соответственно на
https://app1.domain.ru/
https://app2.domain.ru/
https://app3.domain.ru/