Skip to content

Instantly share code, notes, and snippets.

@abdennour
Created November 10, 2021 17:36
Show Gist options
  • Select an option

  • Save abdennour/f38c429d53993ad79fb0dbc3d1ba7f70 to your computer and use it in GitHub Desktop.

Select an option

Save abdennour/f38c429d53993ad79fb0dbc3d1ba7f70 to your computer and use it in GitHub Desktop.

Revisions

  1. abdennour created this gist Nov 10, 2021.
    3 changes: 3 additions & 0 deletions Docerfile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    FROM nginx:1.19-alpine-perl
    ENV NGINX_ENVSUBST_OUTPUT_DIR=/etc/nginx
    COPY my-nginx.conf.template /etc/nginx/templates/
    8 changes: 8 additions & 0 deletions docker-compose.yaml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    version: '3'

    services:
    app:
    build: .
    environment:
    INGRESS_HOSTNAME: git.example.com
    BACKEND_HOSTNAME: 192.168.11.34
    32 changes: 32 additions & 0 deletions my-nginx.conf.template
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,32 @@
    user nginx;
    worker_processes auto;

    error_log /var/log/nginx/error.log warn;
    pid /var/run/nginx.pid;

    events {
    worker_connections 1024;
    }

    http {
    # include /etc/nginx/mime.types;
    default_type application/octet-stream;

    log_format main '$remote_addr - $remote_user [$time_local] "$request" '
    '$status $body_bytes_sent "$http_referer" '
    '"$http_user_agent" "$http_x_forwarded_for"';

    access_log /var/log/nginx/access.log main;
    sendfile on;
    #tcp_nopush on;
    keepalive_timeout 65;
    #gzip on;
    server {
    listen 80;
    location / {
    proxy_set_header Host "$INGRESS_HOSTNAME";
    proxy_pass http://$BACKEND_HOSTNAME;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
    }
    }