summaryrefslogtreecommitdiff
path: root/etc/nginx/sites-enabled/env.site
blob: b3577b3cd03a7133c99c8b29ba6cfc7cb2935881 (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
server {
  listen 80;
  listen [::]:80;
  server_name env.taler.net;
  rewrite ^ https://$host$request_uri? permanent;
}

server {
  listen 443 ssl;
  listen [::]:443 ssl;
  server_name env.taler.net;
  include conf.d/talerssl;
  root /dev/null;

  # add trailing slashes to apps
  rewrite ^/(?<user>[a-zA-Z0-9-_]+)/(?<app>[a-zA-Z0-9-_]+)$ /$user/$app/ redirect;
  # add trailing slashes to user
  rewrite ^/(?<user>[a-zA-Z0-9-_]+)$ /$user/ redirect;
  # relative redirect on landing lage
  rewrite ^/(?<user>[a-zA-Z0-9-_]+)/redir_app_rel/(?<req>.*) /$user/$req redirect;
  # relative redirect in apps
  rewrite ^/(?<user>[a-zA-Z0-9-_]+)/(?<app>[a-zA-Z0-9-_]+)/(.*/)?redir_app_rel/(?<req>.*) /$user/$app/$req redirect;

  # aliases to get from one page to the other
  rewrite ^/(?<user>[a-zA-Z0-9-_]+)/(?<app>[a-zA-Z0-9-_]+)/landing /$user/ redirect;
  rewrite ^/(?<user>[a-zA-Z0-9-_]+)/(?<app>[a-zA-Z0-9-_]+)/bank /$user/bank redirect;
  rewrite ^/(?<user>[a-zA-Z0-9-_]+)/(?<app>[a-zA-Z0-9-_]+)/shop /$user/shop redirect;
  rewrite ^/(?<user>[a-zA-Z0-9-_]+)/(?<app>[a-zA-Z0-9-_]+)/donations /$user/donations redirect;

  location ~ ^/(?<user>[a-zA-Z0-9-_]+)/exchange/admin/(?<req>.*) {
    proxy_pass http://unix:/home/$user/sockets/exchange-admin.http:/admin/$req;
    proxy_redirect off;
    proxy_set_header Host $host;
  }

  location ~ ^/(?<user>[a-zA-Z0-9-_]+)/exchange/(?<req>.*) {
    proxy_pass http://unix:/home/$user/sockets/exchange.http:/$req$is_args$args;
    proxy_redirect off;
    proxy_set_header Host $host;
  }

  location ~ ^/(?<user>[a-zA-Z0-9-_]+)/merchant-backend/(?<req>.*) {
    proxy_pass http://unix:/home/$user/sockets/merchant.http:/$req;
    proxy_redirect off;
    proxy_set_header Host $host;
  }

  location ~ ^/(?<user>[a-zA-Z0-9-_]+)/bank(?<req>/?.*|)$ {
    uwsgi_pass unix:/home/$user/sockets/bank.uwsgi;
    include /etc/nginx/uwsgi_params;
    uwsgi_param SCRIPT_NAME "/$user/bank/";
    uwsgi_param PATH_INFO "$req";
  }

  location ~ ^/(?<user>[a-zA-Z0-9-_]+)/shop(?<req>/?.*|)$ {
    uwsgi_pass unix:/home/$user/sockets/shop.uwsgi;
    include /etc/nginx/uwsgi_params;
    uwsgi_param SCRIPT_NAME "/$user/shop/";
    uwsgi_param PATH_INFO "$req";
  }

  location ~ ^/(?<user>[a-zA-Z0-9-_]+)/donations(?<req>/.*|)$ {
    uwsgi_pass unix:/home/$user/sockets/donations.uwsgi;
    include /etc/nginx/uwsgi_params;
    uwsgi_param SCRIPT_NAME "/$user/donations/";
    uwsgi_param PATH_INFO "$req";
  }

  location ~ ^/(?<user>[a-zA-Z0-9-_]+)(?<req>/.*|)$ {
    ssi on;
    uwsgi_pass unix:/home/$user/sockets/landing.uwsgi;
    include /etc/nginx/uwsgi_params;
    uwsgi_param SCRIPT_NAME "/$user/";
    uwsgi_param PATH_INFO "$req";
  }

  location ~ ^/(?<user>[a-zA-Z0-9-_]+)/auditor(?<req>/.*|)$ {
    ssi on;
    uwsgi_pass unix:/home/$user/sockets/auditor.uwsgi;
    include /etc/nginx/uwsgi_params;
    uwsgi_param SCRIPT_NAME "/$user/";
    uwsgi_param PATH_INFO "$req";
  }

  include conf.d/favicon_robots;
}