my eye

nginx_application.conf

$def with (run_dir, onion)
add_header  Strict-Transport-Security
              "max-age=63072000; includeSubDomains; preload"  always;
add_header  X-Frame-Options  SAMEORIGIN;
add_header  X-Content-Type-Options  nosniff;
add_header  X-XSS-Protection  "1; mode=block";
add_header  Onion-Location  http://$onion$$request_uri;

charset               utf-8;
client_max_body_size  0;

location  ~  /code/projects/([\w.-]+)\.git(/git-receive-pack)$$  {
    auth_basic            "Restricted";
    auth_basic_user_file  $run_dir/code/meta/gitpasswd;
    # TODO auth_request      /auth/introspection;

    fastcgi_pass   unix:/var/run/fcgiwrap.socket;
    include        fastcgi_params;
    fastcgi_param  SCRIPT_FILENAME      /usr/lib/git-core/git-http-backend;
    fastcgi_param  GIT_HTTP_EXPORT_ALL  "";
    fastcgi_param  GIT_PROJECT_ROOT     $run_dir/code/meta/$$1/source.git;
    fastcgi_param  PATH_INFO            $$2;
}
location  ~  /code/projects/([\w.-]+)\.git(.+)  {
    fastcgi_pass   unix:/var/run/fcgiwrap.socket;
    include        fastcgi_params;
    fastcgi_param  SCRIPT_FILENAME      /usr/lib/git-core/git-http-backend;
    fastcgi_param  GIT_HTTP_EXPORT_ALL  "";
    fastcgi_param  GIT_PROJECT_ROOT     $run_dir/code/meta/$$1/source.git;
    fastcgi_param  PATH_INFO            $$2;
}
location  ~  /code/projects/([\w\.-]+)/releases/([a-z0-9\._]+\-.+)  {
    alias  $run_dir/code/meta/$$1/releases/$$2;
}

location  /X/  {
    internal;
    alias  /home/admin/app/run/;
}

location  /hls  {
    root  $run_dir/media/streaming;
    add_header  Cache-Control  no-cache;
    add_header  Access-Control-Allow-Origin  *;
    types {
        application/vnd.apple.mpegurl  m3u8;
    }
}
location  /stream-stats  {
    rtmp_stat  all;
}

location  /chats/  {
    alias  $run_dir/media/chat/mediasoup-demo/server/public/;
}

location  /pads/  {
    proxy_pass          http://127.0.0.1:9001/;
    proxy_buffering     off;
    proxy_http_version  1.1;
    proxy_pass_header   Server;

    proxy_set_header  Host  $$host;
    proxy_set_header  Upgrade  $$http_upgrade;
    proxy_set_header  Connection  $$connection_upgrade;
    proxy_set_header  X-Real-IP  $$remote_addr;
    proxy_set_header  X-Forwarded-For  $$remote_addr;
    proxy_set_header  X-Forwarded-Proto  $$scheme;
}

location  /  {
    proxy_set_header  X-Forwarded-Proto  $$scheme;
    proxy_set_header  Host  $$http_host;
    proxy_set_header  X-Forwarded-For  $$proxy_add_x_forwarded_for;
    proxy_redirect  off;
    proxy_pass  http://unix:$run_dir/gunicorn.sock;
}
# leave this here for cat'ing over SSH...