
나는 사용하고있다서버 A(WordPress용 웹 서버인 NGINX) 및서버 B(역방향 프록시로 NGINX) 그리고 Let's Encrypt with Certbot에서 SSL 인증서를 얻은 후서버 B나는 받고있다
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.
JPG나 CSS 없이 페이지가 로드됩니다.
서버 A 구성
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 {
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;
}
}
~에서버 AWordPress에서 호스팅됩니다. 내 구성 파일이 엉망이 된 것 같아서 누군가 나를 도와줄 수 있나요?... 미리 감사드립니다.
해결책:Nginx cfg에 추가됨:
add_header 'Content-Security-Policy' 'upgrade-insecure-requests';
WordPress WordPress 주소(URL) 및 사이트 주소(URL)에서도 변경되었습니다.