aboutsummaryrefslogtreecommitdiff
path: root/nginx_config
blob: b18fb0953c18b57453a2ece0c682877fbeaa01f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# an example config for running nginx with dash_server.py as the backend

# define connection to dash_server.py
upstream dash_server_py {
    server [::1]:8000;
}

# this server handles media ingest
# authentication is handled throught TLS client certificates
server {
    # network config
    listen [::]:8001 ssl default_server;
    server_name <server name>;

    # server's TLS cert+key
    ssl_certificate <path to TLS cert>;
    ssl_certificate_key <path to TLS key>;
    #ssl_dhparam <path to DH params, optional>;

    # source authentication with TLS client certificates
    ssl_client_certificate <path to CA for client certs>;
    ssl_verify_client on;

    # only allow upload requests
    if ($request_method !~ ^(POST|PUT|DELETE)$) {
        return 405; # Method Not Allowed
    }

    root <path to site root>;

    # define parameters for communicating with dash_server.py
    # enable chunked transfers
    proxy_http_version        1.1;
    proxy_buffering           off;
    proxy_request_buffering   off;
    # finish the upload even if the client does not bother waiting for our
    # response
    proxy_ignore_client_abort on;

    location /live/ {
        proxy_pass http://dash_server_py;
    }
}

server {
    # network config
    listen [::]:80 default_server;
    server_name <server name>;

    # tweak to your site and uncomment for TLS
    #listen [::]:443 ssl;
    #ssl_certificate <path to TLS cert>;
    #ssl_certificate_key <path to TLS key>;
    #ssl_dhparam <path to DH params, optional>;

    if ($request_method !~ ^(GET|HEAD)$) {
        return 405; # Method Not Allowed
    }

    root <path to site root>;

    index index.html;

    # define parameters for communicating with dash_server.py
    # enable chunked transfers
    proxy_http_version        1.1;
    proxy_buffering           off;
    proxy_request_buffering   off;
    # finish the upload even if the client does not bother waiting for our
    # response
    proxy_ignore_client_abort on;

    add_header Access-Control-Allow-Origin *;

    location / {
       try_files $uri $uri/ =404;
    }

    location /live/ {
        try_files $uri @dash_server;
    }

    location @dash_server {
        proxy_pass http://dash_server_py;
    }
}