Gemischter Inhalt des NGINX-Reverse-Proxys, wahrscheinlich Konfigurationsfehler

Gemischter Inhalt des NGINX-Reverse-Proxys, wahrscheinlich Konfigurationsfehler

Ich benutzeServer A(NGINX als Webserver für WordPress) undServer B(NGINX als Reverse-Proxy) und nach Erhalt der SSL-Zertifikate von Let's Encrypt mit Certbot aufServer BIch erhalte

Mixed Content: The page at 'https://example.net/' was loaded over 
 HTTPS, but requested an insecure script 
'http://xx.xx.xx.xx/wp-includes/js/wp-emoji-release.min.js?ver=5.8'. 
This request has been blocked; the content must be served over HTTPS.

Und die Seite wird ohne JPG oder CSS geladen.
Server A cfg

server {
            listen 80;
            root /var/www/wordpress;
            index index.php index.html;

            access_log /var/log/nginx/example.access.log;
            error_log /var/log/nginx/example.error.log;

            location / {
                        try_files $uri $uri/ =404;
            }

            location ~ \.php$ {
                         include snippets/fastcgi-php.conf;
                         fastcgi_pass unix:/run/php/php7.4-fpm.sock;
            }

            location ~ /\.ht {
                         deny all;
            }

            location = /favicon.ico {
                         log_not_found off;
                         access_log off;
            }

            location = /robots.txt {
                         allow all;
                         log_not_found off;
                         access_log off;
           }

            location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
                         expires max;
                         log_not_found off;
           }

            location /wp-admin/ {
                index index.php
            try_files $uri $uri /index.php?$args;
    }
}

Server B cfg

server {
    if ($host = example.net) {
        return 301 https://example.net$request_uri;
    }

    if ($host = www.example.net) {
        return 301 https://example.net$request_uri;
    }

   server_name example.net www.example.net;
    listen 80;
    return 404;

}
server {
        listen 0.0.0.0:443 ssl http2;

        server_name example.net www.example.net;

         ssl_certificate      /etc/letsencrypt/live/example.net/fullchain.pem;
         ssl_certificate_key  /etc/letsencrypt/live/example.net/privkey.pem;

        location ~ /.well-known/acme-challenge {
                allow all;
        }

    location / {

    proxy_pass            http://xx.xx.xx.xx/;
    proxy_read_timeout    90;
    proxy_connect_timeout 90;
    proxy_redirect        off;
    proxy_set_header X-Forwarded-Host $host;
    proxy_set_header X-Forwarded-Server $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header Host $host;
    proxy_ssl_server_name on;

    }
}

AnServer Awird von WordPress gehostet. Kann mir jemand helfen, da meine Konfigurationsdateien wahrscheinlich durcheinander geraten sind.... Vielen Dank im Voraus.

Lösung:in Nginx cfg hinzugefügt:

add_header 'Content-Security-Policy' 'upgrade-insecure-requests';

Außerdem wurden in WordPress die WordPress-Adresse (URL) und die Site-Adresse (URL) geändert.

verwandte Informationen