Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

lloydzhou
Copy link

@lloydzhou lloydzhou commented Apr 10, 2025

split nginx.tmpl to support stream module

nginx.tmpl with env TARGET=streamupstream --> stream.conf.d/10-upstream.conf
nginx.tmpl --> default.conf

then, can include upstream.conf in stream block

#2606

usage

# stream.conf
stream {
    include stream.conf.d/10-upstream.conf;

    server {
        listen     8000;
        #TCP traffic will be forwarded to the specified server
        proxy_pass web1.nginx-proxy.example;
    }
}

docker run --detach \
    --name nginx-proxy \
    --publish 80:80 \
    --publish 8000:8000 \
    --volume /var/run/docker.sock:/tmp/docker.sock:ro \
    --volume ./stream.conf:/etc/nginx/toplevel.conf.d/stream.conf:ro \
    nginxproxy/nginx-proxy

@lloydzhou lloydzhou force-pushed the feature-split-dest-config branch from fa95bcb to 856a582 Compare April 12, 2025 05:52
@lloydzhou lloydzhou marked this pull request as draft April 12, 2025 07:10
@lloydzhou lloydzhou marked this pull request as ready for review April 12, 2025 08:35
@lloydzhou lloydzhou marked this pull request as draft April 12, 2025 08:44
@lloydzhou lloydzhou marked this pull request as ready for review April 12, 2025 13:13
@buchdag
Copy link
Member

buchdag commented Aug 20, 2025

Hi

Thanks for the PR.

Unfortunately I'm not fond of the approach of having the nginx.tmpl work in two different contexts with conditional logic, as this won't be maintainable long term.

Running multiple docker-gen processes in the container should also be avoided (a single process can render multiple templates).

@buchdag buchdag added the type/feat PR for a new feature label Aug 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/feat PR for a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants