Answer the question
In order to leave comments, you need to log in
How to configure Docker to work nginx reverse proxy server with nginx http server?
Good afternoon! I'm trying to set up docker on my server and it doesn't quite work out. I have several containers:
1. Ubuntu container (which other containers will use)
2. Container of the site itself (Angular2) plus nginx, which should give the site a reverse proxy to the nginx container
3. nginx_reverse_proxy container (Will take the site from container number 2 and give the site to the user at this url - site.queryme.ru, if the user goes to queryme.ru without a prefix, then he will be given the usual index.html stub.To
build all the containers, I use docker-compose.So
, docker-compose starts normally all containers, and there is not a single error, when I go to the site at queryme.ru, then the stub is correctly given if I already go to
site.queryme.ru then the site does not load and there is nothing in the logs (I suffered with the settings, but nothing happened. I posted the sources on github, you can see the configs there, I would be grateful if you could help
Answer the question
In order to leave comments, you need to log in
It's not entirely clear, you are proxying the site with nginx
server_name site.query.ru;
на
proxy_pass http://site;
networks:
mynetwork:
driver: bridge
ipam:
driver: default
config:
- subnet: 10.10.10.0/24
ip_range: 10.10.0.0/24
gateway: 10.10.10.1
services:
# Контейнер с проксирующим nginx
nginx:
container_name: nginx
build: images/nginx
networks:
- mynetwork
# Контейнер с сайтом
site:
container_name: site
build: images/site
networks:
- mynetwork
Site config:
server {
listen 80;
server_name tender.local;
location / {
proxy_pass http://tender:80/;
}
}
frontend:
build: ./frontend
volumes:
- ./frontend/conf.d:/etc/nginx/conf.d
- ./frontend/log:/var/log/nginx
ports:
- "80:80"
links:
- tender
tender:
build: ./tender
volumes:
- ./tender/html:/var/www/html
- ./tender/log:/var/log/
links:
- mysql:dev-mysql
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question