安装后让我们通过certbot加密我的WordPress网站已停止加载css/js正确。它总是返回Blocked loading mixed active content
。如果我改变http://example.com
到https://example.com
在WP管理面板网站服务器返回too many redirections
错误。
以下是一些详细信息。
我的Nginx配置
server {
server_name example.com www.example.com
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_pass http://127.0.0.1:8000;
include /etc/nginx/mime.types;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/vergisistemi.az/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/vergisistemi.az/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = www.example.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
if ($host = example.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name example.com www.example.com;
return 301 https://$host$request_uri;
# return 404; # managed by Certbot
}
以下是docker ps
返回的内容:
CONTAINER ID IMAGE PORTS NAMES
571d2d2c7e12 wordpress:latest 0.0.0.0:8000->80/tcp, :::8000->80/tcp wordpress
265b6e159bc2 mysql:5.7 3306/tcp, 33060/tcp mysql
2条答案
按热度按时间4bbkushb1#
在寻找解决方案的半天之后,我发现需要做一些小的改变:
第一步,将
define('FORCE_SSL_ADMIN', true);
添加到wp-config.php
文件中;第二步-在nginx配置文件中添加
proxy_set_header X-Forwarded-Proto $scheme;
到location
:瞧!一切都很顺利!
uurv41yg2#
将以下代码添加到wp-config.php的顶部对我来说很有用: