Skip to content

tekn0ir/nginx-stream

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Nginx Stream Dockerfile

Nginx compiled with --with-stream to be able to create proxies or loadbalancers for non http protocols.

This repository contains Dockerfile of Nginx Stream

Base Docker Image

Installation

  1. Install Docker.

  2. Download: docker pull tekn0ir/nginx-stream

(alternatively, you can build an image from Dockerfile:

$ docker build -t="tekn0ir/nginx-stream" github.com/tekn0ir/nginx-stream

Usage

Start deamon

$ docker run -d -p 0.0.0.0:80:80 --name nginx tekn0ir/nginx-stream

Configure

Create configuration files in folders example:

.
|
|-- http.conf.d
|   `-- myhttpservice.conf
|
|-- stream.conf.d
    `-- myotherservice.conf

myhttpservice.conf example config:

upstream myhttpservice {
    server srv1.example.com;
    server srv2.example.com;
    server srv3.example.com;
}

server {
    listen 80;

    location / {
        proxy_pass http://myapp1;
    }
}

myotherservice.conf example config:

upstream myotherservice {
    server srv1.example.com;
    server srv2.example.com;
    server srv3.example.com;
}

server {
    listen 65432;
    proxy_pass myotherservice;
}

For little more help on stream config: https://nginx.org/en/docs/stream/ngx_stream_core_module.html

Start deamon with configs

$ docker run -d -p 80:80 -p 65432:65432 -v `pwd`\http.conf.d:/opt/nginx/http.conf.d  -v `pwd`\stream.conf.d:/opt/nginx/stream.conf.d --name nginx tekn0ir/nginx-stream

Zero downtime reloading of changed configs

If you change settings and need to relaod them on a running container w/o downtime

$ docker exec -ti nginx bash -c 'zero_downtime_reload.sh'

About

Nginx docker image with non http protocol support

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •