Google计算引擎不可能使用SSL证书

Google计算引擎不可能使用SSL证书,ssl,google-compute-engine,Ssl,Google Compute Engine,我正在尝试在我的谷歌计算引擎服务器上安装SSL证书,我在那里安装了一个LAMP堆栈 我已在端口443上为https启用tcp通信。我已经在实例控件上启用了HTTPS 我对/etc/apache2/sites enabled/lamp-server.conf进行了如下修改: <VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www/html <Directory />

我正在尝试在我的谷歌计算引擎服务器上安装SSL证书,我在那里安装了一个LAMP堆栈

我已在端口443上为https启用tcp通信。我已经在实例控件上启用了HTTPS

我对/etc/apache2/sites enabled/lamp-server.conf进行了如下修改:

<VirtualHost *:80>
  ServerAdmin webmaster@localhost
  DocumentRoot /var/www/html
  <Directory />
    Options FollowSymLinks
    AllowOverride None
  </Directory>
  <Directory /var/www/html/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all
  </Directory>
  ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
  <Directory "/usr/lib/cgi-bin">
    AllowOverride None
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    Order allow,deny
    Allow from all
  </Directory>
  ErrorLog ${APACHE_LOG_DIR}/error.log
  # Possible values include: debug, info, notice, warn, error, crit,
  # alert, emerg.
  LogLevel warn
  CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

<IfModule mod_ssl.c>
<VirtualHost MYINSTANCESTATICIP:443>
ServerAdmin webmaster@localhost

DocumentRoot /var/www/html
ServerName www.MYDOMAIN.com
SSLEngine on
SSLCertificateFile /var/www/ssl/SSLCertificateFile.crt
SSLCertificateKeyFile /var/www/ssl/SSLCertificateKeyFile.key
SSLCertificateChainFile /var/www/ssl/SSLCertificateChainFile.crt
</VirtualHost>
</IfModule>

服务器管理员webmaster@localhost
DocumentRoot/var/www/html
选项如下符号链接
不允许超限
选项索引跟随符号链接多视图
允许超越所有
命令允许,拒绝
通融
ScriptAlias/cgi-bin//usr/lib/cgi-bin/
不允许超限
选项+执行CGI-多视图+符号链接所有者匹配
命令允许,拒绝
通融
ErrorLog${APACHE_LOG_DIR}/error.LOG
#可能的值包括:调试、信息、通知、警告、错误、临界值、,
#警惕,埃默格。
日志级别警告
CustomLog${APACHE\u LOG\u DIR}/access.LOG组合
服务器管理员webmaster@localhost
DocumentRoot/var/www/html
服务器名www.MYDOMAIN.com
斯伦金安
SSLCertificateFile/var/www/ssl/SSLCertificateFile.crt
SSLCertificateKeyFile/var/www/ssl/SSLCertificateKeyFile.key
SSLCertificateChainFile/var/www/ssl/SSLCertificateChainFile.crt

为什么这不起作用?它应该可以工作……

您可以使用
sudo apachectl configtest
查看配置错误

您的配置文件看起来不错。尝试以下步骤:

  • 运行
    sudo a2enmod ssl
    命令以启用Apache的ssl mod
  • 重新启动Apache服务:
    sudo服务apache2重新启动
  • 使用开发者控制台,转到
    Compute Engine->VM instances
    单击您的LAMP虚拟机,并确保虚拟机实例由
    http服务器
    https服务器
    标记,这是tcp:80和tcp:443 GCE防火墙规则的目标标记

  • 请解释“不工作”是什么样子。还可以查看您的错误日志文件:
    ${APACHE\u LOG\u DIR}/error.LOG
    以获取线索。我使用http访问该页面,它可以正常工作。我使用https访问页面,发现错误连接被拒绝[Wed Jan 20 06:33:46.667547 2016][mpm\u prefork:notice][pid 950]AH00163:Apache/2.4.10(Debian)配置--恢复正常操作我看到了
    ,但我没有看到
    加载模块ssl\u模块/some/path/mod\u ssl。因此
    非常确定需要加载ssl模块。您可以执行
    apachectl-t-D DUMP_MODULES
    并在输出中查找
    ssl_module
    吗?我在这个帖子中发布了一个更详细的答案: