Answer the question
In order to leave comments, you need to log in
How to make Docker friends with Flask and external nginx?
Good afternoon
Please let me know. There is a Flask application with statics (Gunicorn). I want to dockerize it. However, on the server where I plan to deploy, nginx is already installed. How can you befriend them?
The forums advise creating a separate image for nginx + app + database. But what if part of the system is already functioning?
Answer the question
In order to leave comments, you need to log in
Set a new location in nginx and proxy requests to your container.
Simplified like this:
location /new/app/path/ {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://localhost:8000;
}
upstream backend {
server backend1.example.com weight=5;
server backend2.example.com:8080;
server unix:/tmp/backend3;
server backup1.example.com:8080 backup;
server backup2.example.com:8080 backup;
}
server {
location / {
proxy_pass http://backend;
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question