Nginx配置https的wordpress站点,wp-content目录下资源404解决方案
wordpress 下配置 ssl证书,
server { listen 443; server_name demo.example.com; ssl on; root /data/; ssl_certificate /cert/cert.pem; ssl_certificate_key /cert/cert.key; ssl_session_timeout 5m; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_prefer_server_ciphers on; }
http访问的时候,/wp-content/下的资源一律为404:
后将配置修改为
server { listen 443 ssl; server_name demo.example.com; root /data/; ssl_certificate /cert/cert.pem; ssl_certificate_key /cert/cert.key; ssl_session_timeout 5m; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_prefer_server_ciphers on; }
所有资源请求正常!