/etc/letsencrypt/live/my_domain.ru/
FROM nginx
RUN rm /etc/nginx/conf.d/default.conf
COPY nginx.conf /etc/nginx/conf.d/
server {
listen 95;
server_name my_domain.ru www.my_domain.ru;
proxy_read_timeout 300;
proxy_connect_timeout 300;
proxy_send_timeout 300;
return 301 https://$host:96$request_uri;
}
server {
listen 96 ssl;
server_name my_domain.ru www.my_domain.ru;
proxy_read_timeout 300;
proxy_connect_timeout 300;
proxy_send_timeout 300;
ssl on;
ssl_certificate fullchain.pem;
ssl_certificate_key privkey.pem;
location / {
include uwsgi_params;
uwsgi_pass app:8095;
}
}
nginx:
volumes:
- ./file_setting/fullchain.pem:/etc/nginx/fullchain.pem
- ./file_setting/privkey.pem:/etc/nginx/privkey.pem
build: ./nginx
container_name: t_nginx
restart: always
ports:
- 95:80
depends_on:
- app
app.run(host='0.0.0.0', port=8095, debug=False)
services:
app:
command: python wsgi_docker.py
nginx:
volumes:
- ./file_setting/fullchain.pem:/etc/nginx/fullchain.pem
- ./file_setting/privkey.pem:/etc/nginx/privkey.pem
build: ./nginx
container_name: t_nginx
restart: always
ports:
- 80:95
- 443:96
depends_on:
- app
server {
listen 95;
server_name my_domain.ru www.my_domain.ru;
return 301 https://$host$request_uri;
}
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:
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;
}
}