我尝试在安装了LAMP堆栈的Google Compute Engine服务器上安装SSL证书。
我在端口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>
为什么这不起作用?它应该工作....
答案 0 :(得分:1)
您可以使用sudo apachectl configtest
查看配置错误。
您的配置文件看起来不错。请尝试以下步骤:
sudo a2enmod ssl
命令以启用Apache的SSL模式。sudo service apache2 restart
Compute Engine -> VM instances
,点击您的LAMP VM,确保VM实例被http-server
和https-server
标记,这些是tcp:80和tcp的目标标记:443 GCE防火墙规则。