Nginx反向代理 + Apache2 + PHP + Mysql 组合下的全站点HTTPS

1)wp-config.php中增加以下内容

$_SERVER['HTTP_HOST'] = $_SERVER['HTTP_X_FORWARDED_HOST'];
$_SERVER['HTTPS'] = 'on';

define('WP_HOME', 'https://'.$_SERVER['HTTP_HOST']);
define('WP_SITEURL', 'https://'.$_SERVER['HTTP_HOST']);

define('FORCE_SSL_LOGIN', true);
define('FORCE_SSL_ADMIN', true);

2)nginx 配置

server {
    listen       80;
    server_name  daijiyu.com www.daijiyu.com;
    return 301 https://$server_name$request_uri;
}

server {
    listen 443 ssl;
    server_name www.daijiyu.com;
    ssl_certificate /etc/nginx/ca/1_www.daijiyu.com_bundle.crt;
    ssl_certificate_key /etc/nginx/ca/2_www.daijiyu.com.key;
    ssl_session_timeout 5m;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
    ssl_prefer_server_ciphers on;
    location / {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $http_host;
        proxy_pass http://127.0.0.1:6011;
    }
}