You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

在运行WordPress的GCE实例上配置HTTPS出现连接不安全报错

问题排查与解决方案

你当前的HTTPS非私密连接报错主要由两个核心配置缺陷导致:

  • 自定义443端口虚拟主机未配置域名匹配规则,与默认default-ssl.conf的443主机存在加载优先级冲突
  • 未确认Let's Encrypt证书是否同时覆盖根域名worldbreakersgame.com和www.worldbreakersgame.com二级域名

修复步骤

  1. 编辑/etc/apache2/sites-available/wordpress-https.conf,在<VirtualHost *:443>块内补充域名配置:
<VirtualHost *:443>
  # 新增以下2行域名匹配规则
  ServerName www.worldbreakersgame.com
  ServerAlias worldbreakersgame.com
  # 原有配置保持不变
  ServerAdmin admin@example.com
  DocumentRoot /var/www/html
  SSLEngine on
  SSLCertificateFile "/etc/letsencrypt/live/worldbreakersgame.com/cert.pem"
  SSLCertificateKeyFile "/etc/letsencrypt/live/worldbreakersgame.com/privkey.pem"
  SSLCertificateChainFile "/etc/letsencrypt/live/worldbreakersgame.com/chain.pem"

  <Directory /var/www/html>
    Options -Indexes
    AllowOverride FileInfo
  </Directory>
</VirtualHost>
  1. 禁用冲突的默认SSL站点,启用自定义HTTPS站点:
sudo a2dissite default-ssl.conf
sudo a2ensite wordpress-https.conf
  1. 校验Apache配置合法性,无语法错误后重启服务:
sudo apache2ctl configtest
# 输出 Syntax OK 后执行以下命令重启服务
sudo systemctl restart apache2
  1. 校验证书域名覆盖范围,若缺失www域名需重新签发:
sudo certbot certificates

若输出结果中Domains行仅显示worldbreakersgame.com,执行以下命令签发同时覆盖两个域名的证书:

sudo certbot run --apache -d worldbreakersgame.com -d www.worldbreakersgame.com
  1. 确认Google Cloud VPC防火墙已配置443端口入站规则,允许所有IP访问TCP 443端口。

所有操作完成后清空浏览器缓存,重新访问站点即可消除非私密连接报错。


内容的提问来源于stack exchange,提问作者Elli Amir

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.09.25 02:06:03