summaryrefslogtreecommitdiffstats
path: root/roles/lounge/templates/nginx-site-config
blob: cc6aa4dbf58e2a432b0b6f69249bc9500af8ed06 (plain) (blame)
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
upstream backend {
    server 127.0.0.1:9000;
}

proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=thelounge_cache:10m max_size=3g inactive=120m use_temp_path=off;


server {
	  listen 80;
	  listen [::]:80;
	  server_name chat.emacsconf.org;

	  include snippets/well-known-acme-challenge.conf;

	  location /js-licenses.html { root /var/www/{{lounge_domain}}; }

	  location / {
		    return 302 https://$server_name$request_uri;
	  }
}

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name {{lounge_domain}};

	  include /etc/nginx/tls/{{emacsconf_domain}}.conf;

	  location /js-licenses.html { root /var/www/{{lounge_domain}}; }
    error_page 502 /error.html;
    location = /error.html {
        root /var/www/{{lounge_domain}};
    }
    location / {
        proxy_pass http://backend;
        proxy_http_version 1.1;
        proxy_set_header Connection "upgrade";
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header X-Forwarded-Proto $scheme;

        # by default nginx times out connections in one minute
        proxy_read_timeout 1d;
    }

}

#server {
#	listen 443 ssl http2;
#       listen [::]:443 ssl http2;
#	server_name chat.emacsconf.org;
#
#	include /etc/nginx/tls/emacsconf.org.conf;
#	root /var/www/chat.emacsconf.org;
#}

server {
    listen 80;
    listen [::]:80;
    server_name chat.emacsconf.com chat.emacsconf.net;

    return 302 $scheme://{{lounge_domain}}$request_uri;
}