-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnginx.conf
147 lines (121 loc) · 3.82 KB
/
nginx.conf
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
load_module /usr/lib/nginx/modules/ngx_stream_module.so;
user www-data;
worker_processes auto;
pid /run/nginx.pid;
events {
worker_connections 768;
}
stream {
server {
listen 9343;
ssl_certificate /app/ela/.setup/keys/nginx.crt; # The certificate file
ssl_certificate_key /app/ela/.setup/keys/nginx.key; # The private key file
proxy_pass localhost:9300;
}
}
http {
# some HTTP boilerplate
# No static files to serve
sendfile off;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65s;
send_timeout 40s;
client_header_timeout 40s;
client_body_timeout 40s;
keepalive_requests 1000;
reset_timedout_connection on;
types_hash_max_size 2048;
server_tokens off;
include /etc/nginx/mime.types;
default_type application/json;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
# No logging by default
access_log off;
error_log off;
log_not_found off;
#access_log /var/log/nginx/example.com;
#error_log /var/log/nginx/error.log;
# Use Compression for most text mime-types
gzip on;
gzip_disable "msie6";
gzip_min_length 512;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6; #max=9
gzip_http_version 1.1;
gzip_buffers 16 8k;
gzip_types text/plain text/css application/json application/javascript
text/xml application/xml application/xml+rss text/javascript;
# Sizes
client_body_buffer_size 8k;
client_header_buffer_size 1k;
client_max_body_size 8m;
large_client_header_buffers 4 8k;
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
limit_conn_zone TOTAL zone=CONLIMITALL:8m;
# server on port 80 for HTTP -> HTTPS redirect
server {
listen 80;
listen [::]:80;
server_name _;
return 301 https://$host$request_uri;
}
# The letsencrypt-secured HTTPS server, which proxies our requests
server {
listen 443 ssl;
# Accept any hostname
server_name _;
# server_name example.com;
# ssl_protocols TLSv1.1 TLSv1.2;
# letsencrypt certificate
ssl_certificate /app/ela/.setup/keys/nginx.crt;
ssl_certificate_key /app/ela/.setup/keys/nginx.key;
ssl_session_timeout 1d;
ssl_session_cache shared:SSL-MS:4m;
ssl_session_tickets off;
ssl_protocols TLSv1.2;
ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256';
ssl_prefer_server_ciphers on;
# client certificate
ssl_client_certificate /app/ela/.setup/keys/rootCa.crt;
# make verification optional, so we can display a 403 message to those
# who fail authentication
ssl_verify_client optional;
location @error503 {
default_type text/plain;
add_header Retry-After 1 always;
return 503 "Try again. Maximum clients reached on this node.";
}
location = /ping {
default_type text/plain;
return 200 "";
}
location ~ / {
# if the client-side certificate failed to authenticate, show a 403
# message to the client
if ($ssl_client_verify != SUCCESS) {
return 403;
}
limit_conn CONLIMITALL 8192;
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 Upgrade $http_upgrade;
#proxy_set_header Connection 'upgrade';
# Fix the "It appears that your reverse proxy set up is broken" error.
proxy_pass http://localhost:9200;
proxy_read_timeout 90;
# web sockets
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
#proxy_redirect http://localhost:8080 https://example.com;
}
}
}