-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnginx.conf
More file actions
75 lines (61 loc) · 2.44 KB
/
nginx.conf
File metadata and controls
75 lines (61 loc) · 2.44 KB
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
# nginx.conf
# Enable legacy protocols and ciphers for HTTPS backend
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES128-SHA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA:@SECLEVEL=1';
ssl_prefer_server_ciphers on;
# Proxy settings
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
# HTTP server
server {
listen 80;
server_name _;
location / {
proxy_http_version 1.1;
proxy_pass http://REMOTE_IP:80;
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;
# URL rewriting for HTTP
sub_filter_once off;
sub_filter_types *;
sub_filter "REMOTE_IP" $host;
proxy_redirect http://REMOTE_IP/ http://$host/;
proxy_redirect http://REMOTE_IP:80/ http://$host/;
}
}
# HTTPS server
server {
listen 443 ssl default_server;
server_name _;
# SSL configuration
ssl_certificate /etc/nginx/ssl/proxy.crt;
ssl_certificate_key /etc/nginx/ssl/proxy.key;
location / {
proxy_http_version 1.1;
proxy_pass https://REMOTE_IP:443;
proxy_ssl_protocols TLSv1;
proxy_ssl_verify off;
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;
# URL rewriting for HTTPS
sub_filter_once off;
sub_filter_types *;
sub_filter "REMOTE_IP" $host;
proxy_redirect https://REMOTE_IP/ https://$host/;
proxy_redirect https://REMOTE_IP:443/ https://$host/;
proxy_ssl_conf_command Options UnsafeLegacyRenegotiation;
}
# Security headers
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
# Timeouts
proxy_connect_timeout 60s;
proxy_send_timeout 60s;
proxy_read_timeout 60s;
}