-
Notifications
You must be signed in to change notification settings - Fork 5
/
hub-nginx.conf
51 lines (43 loc) · 1.34 KB
/
hub-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
# 伪静态
set_real_ip_from 0.0.0.0/0;
real_ip_header CF-Connecting-IP;
client_max_body_size 2G;
underscores_in_headers on;
resolver 8.8.8.8 ipv6=off;
resolver_timeout 10s;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_set_header Accept-Encoding "";
proxy_ssl_session_reuse off;
proxy_ssl_server_name on;
proxy_http_version 1.1;
proxy_buffering off;
proxy_request_buffering off;
proxy_max_temp_file_size 0;
proxy_connect_timeout 864000s;
proxy_read_timeout 864000s;
proxy_send_timeout 864000s;
send_timeout 864000s;
location /v2/ {
proxy_pass https://registry-1.docker.io;
proxy_set_header Host registry-1.docker.io;
header_filter_by_lua_block {
local www_auth = ngx.var.upstream_http_www_authenticate
if www_auth then
local new_www_auth = string.gsub(www_auth, "auth.docker.io", "hub.rat.dev")
ngx.header['www-authenticate'] = new_www_auth
end
}
proxy_intercept_errors on;
recursive_error_pages on;
error_page 301 302 307 = @handle_redirect;
}
location /token {
proxy_pass https://auth.docker.io;
proxy_set_header Host auth.docker.io;
}
location @handle_redirect {
set $saved_redirect_location '$upstream_http_location';
proxy_pass $saved_redirect_location;
}