]> WPIA git - infra.git/blob - modules/gigi/templates/nginx.epp
a6ec4254c8fde36e92282481b74c34051eac286a
[infra.git] / modules / gigi / templates / nginx.epp
1 server {
2     listen       0.0.0.0:443 ssl;
3     server_name  api.<%=$systemDomain%>;
4     server_name  secure.<%=$systemDomain%>;
5     ssl_certificate /etc/ssl/private/gigi.crt;
6     ssl_certificate_key /etc/ssl/private/gigi.key;
7
8     ssl_client_certificate /etc/ssl/root.crt;
9     ssl_verify_client on;
10     ssl_verify_depth 4;
11
12     location / {
13         proxy_pass  http://<%=$gigi_ip%>;
14         proxy_set_header Host $host;
15         proxy_set_header X-Real-IP $remote_addr;
16         proxy_set_header X-Real-Proto https;
17         proxy_set_header X-Client-Cert $ssl_client_cert;
18     }
19 }
20
21 server {
22     listen       0.0.0.0:443 ssl;
23     server_name  *.<%=$systemDomain%>;
24     server_name  <%=$systemDomain%>;
25     ssl_certificate /etc/ssl/private/gigi.crt;
26     ssl_certificate_key /etc/ssl/private/gigi.key;
27
28     location / {
29         proxy_pass  http://<%=$gigi_ip%>;
30         proxy_set_header Host $host;
31         proxy_set_header X-Real-IP $remote_addr;
32         proxy_set_header X-Real-Proto https;
33         proxy_set_header X-Client-Cert $ssl_client_cert;
34         <% if($protected != 'no') { %>
35         auth_basic "closed site";
36         auth_basic_user_file /etc/nginx/access.txt;
37         <% } %>
38     }
39     location ~* /.well-known/someca-challenge/* {
40         root /data/challenge;
41     }
42 }
43
44 server {
45     listen       0.0.0.0:80;
46     server_name  *.<%=$systemDomain%>;
47     server_name  <%=$systemDomain%>;
48
49     location / {
50         proxy_pass  http://<%=$gigi_ip%>;
51         proxy_set_header Host $host;
52         proxy_set_header X-Real-IP $remote_addr;
53         proxy_set_header X-Real-Proto http;
54         proxy_set_header X-Client-Cert "";
55         <% if($protected != 'no') { %>
56         auth_basic "closed site";
57         auth_basic_user_file /etc/nginx/access.txt;
58         <% } %>
59     }
60     location ~* /.well-known/someca-challenge/.* {
61         root /data/challenge;
62     }
63 }