summaryrefslogtreecommitdiff
path: root/etc/nginx/sites-enabled/www-ssl.site
blob: e43beda29b5ea13fc2f8797d27a7316a73d8ef20 (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
87
88
89
90
91
92
server {
       listen 443 ssl;
       listen	[::]:443 ssl; ## listen for ipv4; this line is default and implied
	#listen	  [::]:80 default_server ipv6only=on; ## listen for ipv6


	# Make site accessible from http://localhost/
	server_name taler.net;
	server_name www.taler.net;
	include conf.d/talerssl;

        location = / {
            rewrite_by_lua '
              if ngx.var.http_accept_language == nil then
                ngx.redirect("/en/")
              end

              for lang in (ngx.var.http_accept_language .. ","):gmatch("([^,]*),") do
                if string.sub(lang, 0, 2) == "en" then
                  ngx.redirect("/en/")
                end
                if string.sub(lang, 0, 2) == "de" then
                  ngx.redirect("/de/")
                end
                if string.sub(lang, 0, 2) == "fr" then
                  ngx.redirect("/fr/")
                end
                if string.sub(lang, 0, 2) == "it" then
                  ngx.redirect("/it/")
                end
                if string.sub(lang, 0, 2) == "es" then
                  ngx.redirect("/es/")
                end
              end

              ngx.redirect("/en/")
            ';
        }

	location / {
	    root /var/www/taler.net;
	    autoindex off;
	    ssi on;
	    #ssi_last_modified on;

	    rewrite ^/$ /en/ redirect;

	    rewrite ^/(..)/$ /$1/index.html break;

	    rewrite ^/(help/empty-wallet)$ /$1.html break;
	    rewrite ^/wallet-installation\.html$ /en/wallet.html redirect;
            # just to get around cached old redirect
	    rewrite ^/wallet\.en\.html$ /en/wallet.html redirect;
	}

        gzip on;
        gzip_disable "msie6";
        gzip_vary on;
        gzip_proxied any;
        gzip_comp_level 6;
        gzip_buffers 16 8k;
        gzip_http_version 1.1;
        gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript;


	# Note: this will go to /var/www/(videos|releases), which we took out of Git
	location /videos {
	    root /var/www;
            expires max;
	}

        location ~* /videos/.*\.(png|jpg|ogv|webm|gif|svg)$ {
            root /var/www;
            expires max;
        }

	location /releases {
	    root /var/www;
	    autoindex on;
	}

	location /files {
	    root /var/www;
	}

        location ~* \.(png|jpg|jpeg|gif|ico|svg|js|css)$ {
	    root /var/www/taler.net;
            expires 1y;
        }


}