Skip to content

Commit c10b074

Browse files
committed
🐛 修复卡死的问题
使用两个容器提高可用性,去掉nginx缓存
1 parent 2704f01 commit c10b074

File tree

3 files changed

+37
-11
lines changed

3 files changed

+37
-11
lines changed

docker-compose.yml

+13
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,19 @@ services:
1414
labels:
1515
- "autoheal=true"
1616

17+
overture2:
18+
restart: always
19+
image: coolrc/overture
20+
volumes:
21+
- ./config:/overture
22+
healthcheck:
23+
test: dig @127.0.0.1 -p 5353 www.google.com || exit 1
24+
interval: 30s
25+
timeout: 2s
26+
retries: 3
27+
labels:
28+
- "autoheal=true"
29+
1730
doh:
1831
restart: always
1932
image: satishweb/doh-server

doh-server.conf

+3-2
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,14 @@ path = "/dns-query"
3333
# For "tcp-tls", DNS-over-TLS (RFC 7858) will be used to secure the upstream connection.
3434
upstream = [
3535
"udp:overture:5353",
36+
"udp:overture2:5353",
3637
]
3738

3839
# Upstream timeout
39-
timeout = 60
40+
timeout = 5
4041

4142
# Number of tries if upstream DNS fails
42-
tries = 10
43+
tries = 3
4344

4445
# Enable logging
4546
verbose = false

nginx.conf

+21-9
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ stream {
1616
upstream dns {
1717
zone dns 64k;
1818
server overture:5353;
19-
# server overture2:5353;
19+
server overture2:5353;
2020
}
2121

2222
# DNS(TCP) and DNS over TLS (DoT) Server
@@ -39,18 +39,33 @@ http {
3939
}
4040
access_log off;
4141
# Proxy Cache storage - so we can cache the DoH response from the upstream
42-
proxy_cache_path /var/run/doh_cache levels=1:2 keys_zone=doh_cache:10m;
4342
server{
4443
# Listen on standard HTTPS port, and accept HTTP2, with SSL termination
4544
listen 443 ssl http2;
4645
server_name dns.coolrc.top;
46+
server_tokens off;
47+
48+
ssl_protocols TLSv1.2 TLSv1.3; # TLS 1.3 requires nginx >= 1.13.0
49+
ssl_prefer_server_ciphers on;
50+
ssl_ciphers EECDH+AESGCM:EDH+AESGCM;
51+
52+
ssl_ecdh_curve secp384r1; # Requires nginx >= 1.1.0
53+
ssl_session_timeout 10m;
54+
ssl_session_cache shared:SSL:10m;
55+
ssl_session_tickets off; # Requires nginx >= 1.5.9
56+
ssl_stapling on; # Requires nginx >= 1.3.7
57+
ssl_stapling_verify on; # Requires nginx => 1.3.7
58+
ssl_early_data off; # 0-RTT, enable if desired - Requires nginx >= 1.15.4
59+
resolver overture:5353 valid=300s;
60+
4761
ssl_certificate /ssl/fullchain.pem;
4862
ssl_certificate_key /ssl/privkey.pem;
49-
ssl_session_cache shared:ssl_cache:10m;
50-
ssl_session_timeout 10m;
5163

52-
# DoH may use GET or POST requests, Cache both
53-
proxy_cache_methods GET POST;
64+
# HTTP Security Headers
65+
add_header X-Frame-Options DENY;
66+
add_header X-Content-Type-Options nosniff;
67+
add_header X-XSS-Protection "1; mode=block";
68+
add_header Strict-Transport-Security "max-age=63072000";
5469

5570
# Return 404 to all responses, except for those using our published DoH URI
5671
location / {
@@ -65,9 +80,6 @@ http {
6580
proxy_http_version 1.1;
6681
proxy_set_header Connection "";
6782

68-
# Enable Cache, and set the cache_key to include the request_body
69-
proxy_cache doh_cache;
70-
proxy_cache_key $scheme$proxy_host$uri$is_args$args$request_body;
7183
proxy_pass http://dohsrv/dns-query;
7284
proxy_set_header Host $host;
7385
proxy_set_header X-Real-IP $remote_addr;

0 commit comments

Comments
 (0)