Nginx proxy-pass - ipv6 deaktivieren
Habe ich nginx conf wie folgt:
server {
listen 127.0.0.1:8080;
server_name 127.0.0.1;
client_max_body_size 20m;
include /etc/nginx/conf.d/services/*.conf;
# redirect server error pages to the static page /50x.html
#
error_page 500 /500.json;
error_page 501 /501.json;
error_page 502 /502.json;
error_page 503 /503.json;
error_page 504 /504.json;
error_page 404 /404.json;
location = /500.json {
root /opt/lj/nginx;
}
location = /501.json {
root /opt/lj/nginx;
}
location = /502.json {
root /opt/lj/nginx;
}
location = /503.json {
root /opt/lj/nginx;
}
location = /504.json {
root /opt/lj/nginx;
}
location = /404.json {
root /opt/lj/nginx;
}
}
In der conf.d/services-Verzeichnis habe ich eine Datei mit:
location /api/auth {proxy_pass http://127.0.0.1:8081;}
Habe ich einen upstream-Prozess hören auf 8081 für Anfragen. Fast genau 2 unserer 3 mal, die Anfrage wird umgeleitet entsprechend, aber in jedem Dritten mal, bekomme ich diesen Fehler:
2014/10/09 03:03:52 [alert] 4572#0: *16 socket() failed (97: Address family not supported by protocol) while connecting to upstream, client: 127.0.0.1, server: 127.0.0.1, request: "GET /api/auth/1.0/companies/1/clients HTTP/1.1", upstream: "http://[::1]:8081/api/auth/1.0/companies/1/clients", host: "localhost:8080"
Ich weiß nicht, wie man nginx nur bei uns auf der IPv4-Adresse, die der upstream versteht.
Access logs: (Bitte beachten Sie 1 von 3 versuche Ergebnisse in 500 während der rest pass)
127.0.0.1 - portalAdmin [09/Oct/2014:02:56:37 -0400] "GET /api/auth/1.0/companies/1/clients HTTP/1.1" 500 107 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.101 Safari/537.36" "98.207.234.244"
127.0.0.1 - portalAdmin [09/Oct/2014:02:57:38 -0400] "GET /api/auth/1.0/companies/1/clients HTTP/1.1" 200 2 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.101 Safari/537.36" "98.207.234.244"
127.0.0.1 - portalAdmin [09/Oct/2014:02:57:39 -0400] "GET /api/auth/1.0/companies/1/clients HTTP/1.1" 200 2 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.101 Safari/537.36" "98.207.234.244"
127.0.0.1 - portalAdmin [09/Oct/2014:02:57:41 -0400] "GET /api/auth/1.0/companies/1/clients HTTP/1.1" 500 107 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.101 Safari/537.36" "98.207.234.244"
127.0.0.1 - portalAdmin [09/Oct/2014:03:03:44 -0400] "GET /api/auth/1.0/companies/1/clients HTTP/1.1" 200 2 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.101 Safari/537.36" "98.207.234.244"
127.0.0.1 - portalAdmin [09/Oct/2014:03:03:45 -0400] "GET /api/auth/1.0/companies/1/clients HTTP/1.1" 200 2 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.101 Safari/537.36" "98.207.234.244"
127.0.0.1 - portalAdmin [09/Oct/2014:03:03:46 -0400] "GET /api/auth/1.0/companies/1/clients HTTP/1.1" 500 107 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.101 Safari/537.36" "98.207.234.244"
127.0.0.1 - portalAdmin [09/Oct/2014:03:03:50 -0400] "GET /api/auth/1.0/companies/1/clients HTTP/1.1" 200 2 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.101 Safari/537.36" "98.207.234.244"
127.0.0.1 - portalAdmin [09/Oct/2014:03:03:51 -0400] "GET /api/auth/1.0/companies/1/clients HTTP/1.1" 200 2 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.101 Safari/537.36" "98.207.234.244"
127.0.0.1 - portalAdmin [09/Oct/2014:03:03:52 -0400] "GET /api/auth/1.0/companies/1/clients HTTP/1.1" 500 107 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.101 Safari/537.36" "98.207.234.244"
Jede Hilfe wäre sehr geschätzt werden! Danke.
- Hi, sorry aber wo finde ich die ports.conf-Datei
- Dies kann nicht möglich sein, die gesamte Konfiguration. Schauen Sie auch auf die enthaltenen Dateien.
Du musst angemeldet sein, um einen Kommentar abzugeben.
Vielleicht haben Sie "localhost" anstelle von "127.0.0.1" irgendwo in deiner config. Könnten Sie einen resolver und setzen Sie ipv6 auf off stellen.
Wenn Ihr webservice auf port 8081 ist auf nginx zu, dann aktivieren Sie IPv6 für diese das problem lösen könnte.
Ich hatte das gleiche Problem.
Ändern der Ipv6only=on; ==> zur ==> Ipv6only=off; hat bei mir nicht funktioniert.
Wenn ich entfernt die "Ipv6only=off/on" komplett - es begann wie Charme!
Versuchen, Sie zu entfernen um es vollständig zu entfernen und Neuladen von nginx-Dienst.