eletrotupi / tcc/ ansible/roles/nginx/templates/site.https.j231d5e0a428d4abeb45d3d08451c8e03af2590cc5
1.6 KB | 62 lines Raw
1
server {
2
    listen 80;
3
    server_name {{ vhosts[0] }};
4

5
    location ^~ /.well-known {
6
        root /var/www;
7
    }
8

9
    location / {
10
        return 302 https://$host$request_uri;
11
    }
12
}
13

14
server {
15
    listen 443 ssl;
16
    listen [::]:443 ssl;
17

18
    server_name {{ vhosts[0] }};
19

20
    ssl_certificate {{ nginx_cert_dir }}/{{ vhosts[0] }}/cert.pem;
21
    ssl_certificate_key {{ nginx_cert_dir }}/private/{{ vhosts[0] }}/key.pem;
22

23
    ssl_protocols TLSv1.2 TLSv1.3;
24

25
    add_header X-Clacks-Overhead "GNU Terry Pratchett";
26
    add_header Permissions-Policy interest-cohort=();
27

28
    # Public URL stays /monografia; the artifact was renamed with the source dir
29
    location = /monografia {
30
        alias {{ nginx_static_root }}/thesis.pdf;
31
        add_header Content-Type application/pdf;
32
        add_header Content-Disposition "inline";
33
    }
34

35
    location = /logs {
36
        return 302 /logs/select/vmui/;
37
    }
38

39
    location /logs/ {
40
        auth_basic "nexo logs";
41
        auth_basic_user_file {{ nginx_logs_htpasswd_file }};
42

43
        proxy_pass {{ nginx_logs_proxy_pass }};
44
        proxy_set_header Host $host;
45
        proxy_set_header X-Real-IP $remote_addr;
46
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
47
        proxy_set_header X-Forwarded-Proto $scheme;
48
    }
49

50
    location / {
51
        proxy_pass {{ nginx_proxy_pass }};
52
        proxy_set_header Host $host;
53
        proxy_set_header X-Real-IP $remote_addr;
54
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
55
        proxy_set_header X-Forwarded-Proto $scheme;
56
        proxy_set_header X-Forwarded-Host $host;
57
    }
58

59
    location ^~ /.well-known {
60
        root /var/www;
61
    }
62
}