Answer the question
In order to leave comments, you need to log in
One domain and multiple applications in docker how to reverse nginx proxy?
Help setting up nginx
There are several containerized application applications hanging in docker on the same machine but on different ports.
Each application separately works on different ports
I want the following scheme of operation
domain.ru /app1
domain.ru/v1 --/app2
domain.ru/v3 --/app3
Config
location / {
if ($request_method !~ ^(OPTIONS|GET|HEAD|POST|PUT|DELETE|TRACE|CONNECT|PROPFIND|PROPPATCH|MKCOL|COPY|MOVE|LOCK|UNLOCK|VERSION-CONTROL|REPORT|CHECKOUT|CHECKIN|UNCHECKOUT|MKWORKSPACE|UPDATE|LABEL|MERGE|BASELINE-CONTROL|MKACTIVITY|ORDERPATCH|ACL|SEARCH|MKCALENDAR|PATCH)$) {
return 405;
}
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;
proxy_read_timeout 300s;
proxy_send_timeout 300s;
client_max_body_size 1024m;
proxy_connect_timeout 1s;
proxy_redirect off;
{#- it's allways eth0 interface in VM #}
proxy_pass http://127.0.0.1:3000;
}
location /education {
if ($request_method !~ ^(OPTIONS|GET|HEAD|POST|PUT|DELETE|TRACE|CONNECT|PROPFIND|PROPPATCH|MKCOL|COPY|MOVE|LOCK|UNLOCK|VERSION-CONTROL|REPORT|CHECKOUT|CHECKIN|UNCHECKOUT|MKWORKSPACE|UPDATE|LABEL|MERGE|BASELINE-CONTROL|MKACTIVITY|ORDERPATCH|ACL|SEARCH|MKCALENDAR|PATCH)$) {
return 405;
}
proxy_set_header Host $host;
proxy_set_header X-Scheme https;
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;
# WS settings
proxy_http_version 1.1;
proxy_read_timeout 900s;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
{#- it's allways eth0 interface in VM #}
proxy_pass http://127.0.0.1:9000;
}
Answer the question
In order to leave comments, you need to log in
I realize the answer is off-topic, but it was for similar reasons that I dropped nginx as a reverse.
Tired of setting up.
I advise traefik, spend a day studying and forget these configs like a bad dream:
https://habr.com/ru/post/508636/
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question