dendrite/server/templates/nginx.conf.j2
author Luke Hoersten <luke@hoersten.org>
Sun, 18 Jul 2021 20:17:16 -0500
changeset 164 ae19501f5251
parent 163 40b78af86337
child 167 e3c49bf5fae9
permissions -rw-r--r--
Updated minecraft to be multi-world and minimized world size.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
119
a96a5eb96e32 Added nginx config template.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     1
server {
a96a5eb96e32 Added nginx config template.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     2
    listen 80;
a96a5eb96e32 Added nginx config template.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     3
    server_name {{nginx_server_name}};
a96a5eb96e32 Added nginx config template.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     4
    return 301 https://$host$request_uri;
a96a5eb96e32 Added nginx config template.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     5
}
a96a5eb96e32 Added nginx config template.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     6
163
40b78af86337 Tons of updates.
Luke Hoersten <luke@hoersten.org>
parents: 159
diff changeset
     7
# Enable SSL session caching for improved performance
40b78af86337 Tons of updates.
Luke Hoersten <luke@hoersten.org>
parents: 159
diff changeset
     8
ssl_session_cache shared:ssl_session_cache:10m;
40b78af86337 Tons of updates.
Luke Hoersten <luke@hoersten.org>
parents: 159
diff changeset
     9
119
a96a5eb96e32 Added nginx config template.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    10
server {
163
40b78af86337 Tons of updates.
Luke Hoersten <luke@hoersten.org>
parents: 159
diff changeset
    11
    listen {{nginx_server_port}} ssl http2;
119
a96a5eb96e32 Added nginx config template.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    12
    server_name {{nginx_server_name}};
a96a5eb96e32 Added nginx config template.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    13
a96a5eb96e32 Added nginx config template.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    14
    ssl_certificate {{nginx_ssl_cert}};
a96a5eb96e32 Added nginx config template.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    15
    ssl_certificate_key {{nginx_ssl_privkey}};
163
40b78af86337 Tons of updates.
Luke Hoersten <luke@hoersten.org>
parents: 159
diff changeset
    16
    include /etc/letsencrypt/options-ssl-nginx.conf;
40b78af86337 Tons of updates.
Luke Hoersten <luke@hoersten.org>
parents: 159
diff changeset
    17
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
119
a96a5eb96e32 Added nginx config template.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    18
163
40b78af86337 Tons of updates.
Luke Hoersten <luke@hoersten.org>
parents: 159
diff changeset
    19
    ssl_ecdh_curve X25519:prime256v1:secp384r1:secp521r1;
40b78af86337 Tons of updates.
Luke Hoersten <luke@hoersten.org>
parents: 159
diff changeset
    20
    ssl_stapling on;
40b78af86337 Tons of updates.
Luke Hoersten <luke@hoersten.org>
parents: 159
diff changeset
    21
    ssl_stapling_verify on;
119
a96a5eb96e32 Added nginx config template.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    22
163
40b78af86337 Tons of updates.
Luke Hoersten <luke@hoersten.org>
parents: 159
diff changeset
    23
    gzip_vary on;
40b78af86337 Tons of updates.
Luke Hoersten <luke@hoersten.org>
parents: 159
diff changeset
    24
    gzip_proxied any;
40b78af86337 Tons of updates.
Luke Hoersten <luke@hoersten.org>
parents: 159
diff changeset
    25
    gzip_comp_level 6;
40b78af86337 Tons of updates.
Luke Hoersten <luke@hoersten.org>
parents: 159
diff changeset
    26
    gzip_buffers 16 8k;
40b78af86337 Tons of updates.
Luke Hoersten <luke@hoersten.org>
parents: 159
diff changeset
    27
    gzip_http_version 1.1;
40b78af86337 Tons of updates.
Luke Hoersten <luke@hoersten.org>
parents: 159
diff changeset
    28
    gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript application/activity+json application/atom+xml;
119
a96a5eb96e32 Added nginx config template.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    29
163
40b78af86337 Tons of updates.
Luke Hoersten <luke@hoersten.org>
parents: 159
diff changeset
    30
    # the nginx default is 1m, not enough for large media uploads
40b78af86337 Tons of updates.
Luke Hoersten <luke@hoersten.org>
parents: 159
diff changeset
    31
    client_max_body_size 16m;
119
a96a5eb96e32 Added nginx config template.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    32
163
40b78af86337 Tons of updates.
Luke Hoersten <luke@hoersten.org>
parents: 159
diff changeset
    33
    proxy_set_header Host              $host;
40b78af86337 Tons of updates.
Luke Hoersten <luke@hoersten.org>
parents: 159
diff changeset
    34
    proxy_set_header X-Real-IP         $remote_addr;
40b78af86337 Tons of updates.
Luke Hoersten <luke@hoersten.org>
parents: 159
diff changeset
    35
    proxy_set_header X-Forwarded-For   $remote_addr;
40b78af86337 Tons of updates.
Luke Hoersten <luke@hoersten.org>
parents: 159
diff changeset
    36
    proxy_set_header X-Forwarded-Proto $scheme;
40b78af86337 Tons of updates.
Luke Hoersten <luke@hoersten.org>
parents: 159
diff changeset
    37
    proxy_read_timeout                 600;
40b78af86337 Tons of updates.
Luke Hoersten <luke@hoersten.org>
parents: 159
diff changeset
    38
40b78af86337 Tons of updates.
Luke Hoersten <luke@hoersten.org>
parents: 159
diff changeset
    39
    location /_matrix {
119
a96a5eb96e32 Added nginx config template.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    40
        proxy_pass http://127.0.0.1:{{nginx_proxy_port}};
a96a5eb96e32 Added nginx config template.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    41
    }
a96a5eb96e32 Added nginx config template.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    42
}