中资源虚拟主机证书故障_HTTPS访问404
HTTPS访问404的配置流程:生成 CSR(或面板自动生成)→ 申请证书(Let's Encrypt 自动/付费证书上传)→ 部署证书(Nginx/Apache/IIS/面板)→ 强制 HTTPS(301跳转)→ 修复混合内容 → 测试。虚拟主机在面板"SSL 管理"里一键部署。
混合内容:HTTPS 页面里引用了 http 的 CSS/JS/图片/字体,浏览器会拦截或警告。解决方法:页面里的资源链接用相对协议(//域名/资源)或 https;数据库里的 http 链接批量替换为 https;CDN 开启自动 HTTPS 改写。F12控制台看 Mixed Content 警告,逐个修复。
参考(SSL配置与排查): ``` # Nginx SSL配置 server { listen 443 ssl http2; server_name 域名; ssl_certificate /www/server/panel/vhost/cert/域名/fullchain.pem; ssl_certificate_key /www/server/panel/vhost/cert/域名/privkey.pem; ssl_protocols TLSv1.2 TLSv1.3; ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256; ssl_prefer_server_ciphers on; ssl_session_cache shared:SSL:10m; add_header Strict-Transport-Security "max-age=31536000" always; root /www/wwwroot/域名; index index.html index.php; }
# HTTP跳转HTTPS server { listen 80; server_name 域名; return 301 https://$host$request_uri; }
# 检查证书有效期 openssl s_client -connect 域名:443 -servername 域名 2>/dev/null | openssl x509 -noout -dates -subject
# Apache .htaccess强制HTTPS RewriteEngine On RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] ```
未强制HTTPS 是 HTTPS访问404的常见问题。证书过期续签;证书域名不匹配重新申请包含所有域名的证书;证书链不完整用完整链证书(含中间证书);私钥不匹配用对应私钥;混合内容替换为 https;未强制 HTTPS 配置301;HTTPS 端口未开放行443;CDN 证书未同步在 CDN 后台部署。
HSTS 配置:Strict-Transport-Security 头告诉浏览器只能用 HTTPS 访问。Nginx:add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;。开启后用户访问 http 会被浏览器内部跳转到 https,更安全。但要确保全站 HTTPS 稳定后再开,否则有问题无法回退。

更新时间:2026-09-01 15:59:20