I am running 2 containers on a server. They are both docker containers with the default nginx image.
I am trying to use Container1 as a reverse proxy for Container2.
Container1 is at ip address 172.17.0.3
Container2 is at ip address 172.17.0.4
when I curl Container1 i get the default Nginx homepage.
I have edited the default homepage for container 2 so that it is just
<p> HI </p> which is verified by a curl on the ip.
on my servers etc/hosts file, i added this line
172.17.0.3 testapp.net
My Container1's /etc/nginx/conf.d/default.conf is this
server {
listen 80;
server_name localhost;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
server {
listen 80;
server_name testapp.net;
location / {
proxy_pass http://172.17.0.4
}
}
when i do curl testapp.net i get the home page for Container1's nginx(the basic hello nginx html file) and am not directed to Container2. Why is this happening?