DEV Community

bowlerdesign.tech
bowlerdesign.tech

Posted on • Originally published at bowlerdesign.tech on

How to Route Nginx Through a Child Nginx Configuration - Jumpbox to Web Server Configuration

I had a specific use case where I needed to run a docker instance, which had it's own configured nginx instance.

The issue was that I already use nginx on my JumpBox.

The fix was relatively self explanatory, but I wanted somewhere to write down the issues that I had to tackle.

The Solution

So the solution is just to point nginx (JumpBox) to the other nginx instance (docker).

Just to let you know, in my case, there are separate physical servers. The configuration will not differ, but you may need to internally expose ports between hosts if you have something like UFW installed. I have a tutorial here on how to set up UFW.

So on my Host B I have a web instance running on port 8080. This web instance is an nginx reverse proxy that is pointing to another docker instance within the same docker network on the machine.

Host A is my existing nginx reverse proxy.

The quick solution is to forward your call from Host A to Host B.

Like so

server {
  server_name blog.bowlerdesign.tech;

  location / {
    proxy_pass http://host_running_blog:8080;
  }

Enter fullscreen mode Exit fullscreen mode

I ran into issues here, I couldn't get css loading properly when navigating to blog.bowlerdesign.tech.

I was missing headers in the request. Here's an ideal configuration for setting up a website.

server {
  server_name blog.bowlerdesign.tech;

  location / {
    proxy_pass http://host_running_blog:8080;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto scheme;
    proxy_pass_header Content-Type;
  }

Enter fullscreen mode Exit fullscreen mode

This will forward the necessary headers for your host.

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read full post →

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more