0
도킹 컨테이너 안에있는 것을 포함하여 여러 웹 응용 프로그램에 대한 프록시 연결을 Nginx에 요청하려고합니다.도킹 컨테이너 용 리버스 프록시로 사용되는 Nginx
모두 웹 어플리케이션 내가 다음 dockerfile을 사용하고
proxy_pass URL을 연결할 수 :
# Set the base image to Ubuntu
FROM ubuntu
RUN apt-get update
RUN apt-get install -y nginx
RUN rm -v /etc/nginx/nginx.conf
RUN echo "daemon off; \n\
\n\
worker_processes 1; \n\
events { worker_connections 1024; } \n\
\n\
http { \n\
\n\
server { \n\
listen 99; \n\
\n\
server_name dashboard; \n\
location/{ \n\
proxy_pass http://dashboard:80; \n\
} \n\
location /app1 { \n\
proxy_pass http://otherhostname:9000/app1; \n\
} \n\
} \n\
} \n\
" >> /etc/nginx/nginx.conf
EXPOSE 99
CMD service nginx start
대시 보드를 내가 APP1에 도달 할 수있는 서비스 (컨테이너)로 이것을 실행하지만,하지 않을 경우.
내가 이상한 일은 이전에이 작업을했기 때문에 dockerfile의 근본적인 요소를 변경하지 않았다는 것입니다. 내가 놓친 게 있니?
편집 : (I 현재 포트 80에서 대시 보드를 노출 한과의 nginx와 99에 테스트입니다)
내가 가진의 nginx 컨테이너를 실행
대시 보드는 올바른 포트를있다
docker service create \
--replicas 1 \
--name nginx \
-p 99:99 \
nginx_image
드러난.
docker service create \
--replicas 1 \
--name dashboard \
-p 80:8080 \
dashboard_image
내가 찾은의 nginx를하는 error.log에 상대 : 의도 한대로
2016/11/08 08:46:41 [error] 25#25: *42 upstream timed out (110: Connection timed out) while connecting to upstream, client: 10.255.0.3, server: dashboard, request: "GET/HTTP/1.1", upstream: "http://dockerhostip:80/", host: "dashboard:99"
'nginx' 및'dashboard' 컨테이너 설정 방법에 대한 정보 (예 :'docker-compose.yml' 파일)도 공유하십시오. – ronkot
도움이 될지 모르지만 나는 똑같은 일을하고 싶다. http://stackoverflow.com/questions/32195108/docker-run-apache-on-host-and-container-for-different-websites/32209615# 32209615 그것은 중복이 아니지만 관련이 있습니다. – AntoineB
감사합니다 얘들 아, 문제는 실제로 nginx가 아닌 대시 보드에서 발견되었습니다. 그게 이상 하네 ~ ~ 잘 작동했기 때문에 ~. 조사로 돌아 가세요! –