Skip to content

best practice to add a stream config? #953

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
udos opened this issue Dec 19, 2024 · 2 comments
Closed

best practice to add a stream config? #953

udos opened this issue Dec 19, 2024 · 2 comments

Comments

@udos
Copy link

udos commented Dec 19, 2024

hi,

I would like to add a stream config similiar to this:

stream {
    server {
      listen 1234;
    
      proxy_connect_timeout 60s;
      proxy_socket_keepalive on;
      proxy_pass localhost:5432;
    }
}

how can I do this?

note: I can not add it to /etc/nginx/conf.d because that is the include directory for http configs...

@Kornelius777
Copy link

Kornelius777 commented Feb 3, 2025

at the end of nginx.conf, I added:

stream {
include /etc/nginx/streams/*;
}

then, I added that directory:
(From within the container:)
mkdir -p /etc/nginx/streams/

now, just place your server { ... } in a stream.conf inside this very directory.
Do NOT place the stream { ... } in there, as that portion is already inside nginx.conf

@thresheek
Copy link
Member

Indeed, it's best to provide an edited /etc/nginx/nginx.conf which will include the directory where you'd want to put the stream configuration files to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants