在Nginx proxy_pass中禁用IPv6
我的服务器没有IPv6地址。 但是,当我将Nginx proxy_pass用于IPv4和IPv6的上游时,有时它会尝试使用IPv6发送传出请求: 2013/07/30 00:25:06 [error] 1930#0: *1482670 connect() to [AAAA:BBBB:C:DDD:E:F:GGG:HHH]:443 failed (101: Network is unreachable) while connecting to upstream, client: AA.BB.CC.DD, server: example.com, request: "GET /download/file HTTP/1.0", upstream: "https://[AAAA:BBBB:C:DDD:E:F:GGG:HHH]:443/download/file", host: "example.com" 如何在proxy_pass中为传出请求禁用IPv6? nginx.conf: upstream download { server download.example.com:443; keepalive 8; } location /download { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Connection …