Score:0

How configure from nginx proxy to a tomcat docker container?

sd flag

I state I'm not an expert I'm learning; said this.....

i can't configure nginx on host to pass requests in tomcat container;

So I installed:

  1. tomcat in the container accessible (example ip) from internet 139.25.4.25:8080 and the example tomcat page is displayed
  2. nginx 139.25.4.25:80 and the sample nginx page is displayed

"tomcat and nginx are on the same machine with the only difference that tomcat is installed in the docker container"

Obviously nginx must not be the webserver but the proxy so I need to disable nginx as a web server and configure it as a proxy.

I tried to modify the default file in the path / etc / nginx / sites-available; the configuration I made it is this:

"" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" " server { listen 80; server_name 139.25.4.25.58; location / private / link1 / { proxy_pass http://127.0.0.1; proxy_set_header Upgrade $ http_upgrade; proxy_set_header Connection $ connection_upgrade; proxy_set_header Host $ host; proxy_set_header X-Real-IP $ remote_addr; proxy_set_header Forwarded $ proxy_add_forwarded; proxy_set_header X-Forwarded-For $ proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $ scheme; proxy_set_header X-Forwarded-Host $ host; proxy_set_header X-Forwarded-Port $ server_port; } "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""

With this configuration nginx failed and does not restart while if I only configure the proxy_pass directive http://127.0.0.1 it does not give me an error in the test but it displays the nginx page when I type 139.25.4.25.58: 80 and instead I want it to be displayed the tomcat page pointing to 127.0.0.1:8080; on this last point I would have doubts that is, first of all when I type ip address or ifconfig on debian I am given the error that is I can not see the ip address in the docker container?

I hope for some help in some indication

Thank you

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.