-
Notifications
You must be signed in to change notification settings - Fork 1
/
custom-nginx.conf.template
97 lines (76 loc) · 2.99 KB
/
custom-nginx.conf.template
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
93
94
95
96
97
add_header X-Frame-Options SAMEORIGIN;
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
upstream kibana {
server kibana:5601;
}
upstream elasticsearch {
server elasticsearch:9200;
}
server {
# Redirect to https
if ($host = DOMAIN_OR_PUBLIC_IP) {
rewrite ^(.*) https://DOMAIN_OR_PUBLIC_IP:443$1 permanent;
} # managed by Certbot
listen 80 default_server;
listen [::]:80 default_server;
server_name DOMAIN_OR_PUBLIC_IP;
# letsencrypt
location /.well-known/acme-challenge {
root /var/www/certbot;
try_files $uri $uri/ =404;
}
# Kibana panel
location /kibana {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
rewrite ^/kibana/(.*)$ /$1 break;
proxy_pass http://kibana/;
}
}
server {
listen 443 ssl default deferred;
listen [::]:443 ssl default deferred;
server_name DOMAIN_OR_PUBLIC_IP;
# SSL Config
ssl_certificate /etc/letsencrypt/live/DOMAIN_OR_PUBLIC_IP/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/DOMAIN_OR_PUBLIC_IP/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/DOMAIN_OR_PUBLIC_IP/fullchain.pem;
ssl_session_cache shared:SSL:50m;
ssl_session_timeout 5m;
ssl_stapling on;
ssl_stapling_verify on;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
ssl_ciphers "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4";
ssl_prefer_server_ciphers on;
# Proxy
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Proto https;
proxy_headers_hash_bucket_size 512;
proxy_redirect off;
# Websockets
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
# Your App
location / {
proxy_pass http://elasticsearch;
}
location /kibana {
rewrite ^/kibana/(.*)$ /$1 break;
proxy_pass http://kibana/;
}
#################################
# LetsEncrypt #
#################################
location /.well-known/acme-challenge {
root /var/www/certbot;
try_files $uri $uri/ =404;
}
}