Ich habe eine Website, die auf AWS gehostet wird.www.beispiel.com. Ich habe ein Blog auf Wix myblog.wixsite.com/blog erstellt. Nun möchte ich den Inhalt von myblog.wixsite.com/blog aufwww.beispiel.com/blog. Also habe ich versucht, dies mit der folgenden Nginx-Konfiguration zu erreichen.
location /blog/ {
sub_filter 'http://myblog.wixsite.com/' 'https://$http_host/blog/';
sub_filter 'https://myblog.wixsite.com/' 'https://$http_host/blog/';
sub_filter 'href="/posts/' 'href="/blog/';
sub_filter 'href="/category/' 'href="/blog/category/';
sub_filter 'href="/authors/' 'href="/blog/authors/';
sub_filter 'href="/recent/' 'href="/blog/recent/';
proxy_ssl_verify off;
proxy_set_header Host "myblog.wixsite.com";
proxy_set_header X-Forwarded-Host "";
proxy_set_header X-Forwarded-For "";
proxy_set_header Accept-Encoding "";
proxy_set_header Cookie "";
proxy_pass http://myblog.wixsite.com/blog/;
proxy_redirect ~^(http://[^/]+)(/.+)$ https://$http_host$2;
}
Wenn ich jetzt drückewww.beispiel.com/blog, Nginx leitet mich weiter zuhttps://myblog.wixsite.com/blog/anstatt den Inhalt anzuzeigen aufwww.beispiel.com/blogselbst. Ich habe auch versucht,
proxy_pass http://myblog.wixsite.com/blog/;
zu zu wechseln proxy_pass https://myblog.wixsite.com/blog/;
, aber ich bekam den folgenden Fehler.
*532 SSL_do_handshake() failed (SSL: error:14077438:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert internal error) while SSL handshaking to upstream, client: <redacted>, server: www.example.com, request: "GET /blog/ HTTP/2.0", upstream: "https://myblog.wixsite.com/blog/", host: "www.example.com"
Ich versuche es schon seit ein paar Tagen, aber ohne Ergebnis. Kann mir jemand sagen, was ich falsch mache?
Antwort1
Verwenden Sie entwederproxy_redirect
oder ändern
proxy_pass http://myblog.wixsite.com/blog/; to
proxy_pass https://myblog.wixsite.com/blog/;
Beachten Sie, dass das Protokoll https
anstelle von lautet http
. Ihr Wix-Blog wird sowieso über HTTPS bereitgestellt.
Antwort2
Nicht nginx sendet die Weiterleitung, sondern die Website https://myblog.wixsite.com/blog/
sendet die Weiterleitung. nginx leitet lediglich die Antwort weiter, die es von der Site erhält.