in Education by
I'm looking for a way to configure Nginx to access hosted services through a subdomain of my server. Those services and Nginx are instantiated with Docker-compose. In short, when typing Jenkins.192.168.1.2, I should access to Jenkins hosted on 192.168.1.2 redirected with Nginx proxy. A quick look at what I currently have. It doesn't work without a top domain name, so it works fine on play-with-docker.com, but not locally with for example 192.168.1.2. server { server_name jenkins.REVERSE_PROXY_DOMAIN_NAME; location / { proxy_pass http://jenkins:8080; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Host $host:$server_port; proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } My overall goal is to access remote docker containers without modifying clients' DNS service. Can you help me with this? Select the correct answer from above options

1 Answer

0 votes
by
 
Best answer
Nginx doesn’t support sub-domains on IP address that you have used and resolving that we need to modify the client's host but in question, you have already mentioned that you don't want to change it(client’s host). For this problem, we have one more solution (ie:-you can set nginx to redirect) for that you need to follow these commands. location /Jenkins { proxy_pass http://jenkins:8080; ... } location /other-container { proxy_pass http://other-container:8080; } It would allow you to your IP address (ie:-192.168.1.2/jenkins) One more way to achieve access by serving the containers through different ports, for that you need to follow this docker file so that you will get easily. server { listen 8081; location / { proxy_pass http://jenkins:8080; ... } server { listen 8082; location / { proxy_pass http://other-container:8080; ... } After building this dockerfile you can access through port -81. Thus, this is the way to configure Nginx to access hosted services through a subdomain of your server. And services and Nginx are instantiated with Docker-compose.

Related questions

0 votes
    Now that links are deprecated in docker-compose.yml (and were able to use the new networking feature to ... docker-compose.yml? Select the correct answer from above options...
asked Feb 8, 2022 in Education by JackTerrance
0 votes
    My docker-compose file has some running docker files to create my containers. I don't want the docker files ... docker-compose syntax? Select the correct answer from above options...
asked Jan 25, 2022 in Education by JackTerrance
0 votes
    I have a dump.sql file that I would like to load with docker-compose. docker-compose.yml: services: postgres: ... how to do this? Select the correct answer from above options...
asked Feb 8, 2022 in Education by JackTerrance
0 votes
    I have a dump.sql file that I would like to load with docker-compose. docker-compose.yml: services: postgres: ... how to do this? Select the correct answer from above options...
asked Feb 5, 2022 in Education by JackTerrance
0 votes
    Do I need to use separate Docker containers for my complex web application or I can put all required services in ... in one container? Select the correct answer from above options...
asked Jan 30, 2022 in Education by JackTerrance
0 votes
    Can someone help me to differentiate between DevOps and Docker? Select the correct answer from above options...
asked Jan 25, 2022 in Education by JackTerrance
0 votes
    I am unable to find the containers under the directory: /var/lib/docker/containers Can you please tell me the ... the host machine? Select the correct answer from above options...
asked Jan 24, 2022 in Education by JackTerrance
0 votes
    I want to expose multiple ports to the machine’s interface. How to achieve this using a docker container? Please help. Select the correct answer from above options...
asked Jan 22, 2022 in Education by JackTerrance
0 votes
    I have created a docker image. I want to push it into my docker repo but I am facing this error: denied: ... to the resource is denied Select the correct answer from above options...
asked Jan 21, 2022 in Education by JackTerrance
0 votes
    There are two web-apps: an app for desktop browser; an app for mobile browser; Ahead of them ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 6, 2022 in Education by JackTerrance
0 votes
    I've got a Node.js powered site that I'm running on Amazon Elastic Beanstalk. My Node.js app listens on port ... to my site via HTTPS. Select the correct answer from above options...
asked Feb 8, 2022 in Education by JackTerrance
0 votes
    Suppose you have two services on your topology API Web Interface Both supposed to be running on port 80. On docker ... to solve this? Select the correct answer from above options...
asked Jan 30, 2022 in Education by JackTerrance
0 votes
    I've been using K8S ConfigMap and Secret to manage our properties. My design is pretty simple, that keeps ... 't been created Select the correct answer from above options...
asked Jan 30, 2022 in Education by JackTerrance
0 votes
    I know this is not directly a programming question, but people on stackoverflow seems to be able to answer ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 19, 2022 in Education by JackTerrance
0 votes
    I know this is not directly a programming question, but people on stackoverflow seems to be able to answer ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 15, 2022 in Education by JackTerrance
...