【问题标题】:Enable HTTPS to my site running on Ubuntu Ec2为我在 Ubuntu Ec2 上运行的站点启用 HTTPS
【发布时间】:2018-03-05 07:29:58
【问题描述】:
我在 Godaddy 中有一个域。
该网站使用 AngularJS 开发并托管在 Ubuntu 16 EC2 中。
我在godaddy中用EC2 IP地址指向了域,它工作正常。
在为我的网站配置 HTTPS 方面需要帮助。
【问题讨论】:
-
-
Use a free cert 来自 Let's Encrypt,但我同意 @avigil - serverfault.com 是解决管理类型问题的更好地方。
标签:
angularjs
amazon-ec2
https
ubuntu-16.04
【解决方案1】:
首先,您需要从 GoDaddy 等 SSL 提供商处购买 SSL 证书。要获得 SSL,您必须向他们提供 .csr 文件。
要生成 CSR 和私钥文件,请使用以下命令
openssl req –new –newkey rsa:2048 –nodes –keyout private.key –out server.csr
当 SSL Provider/GoDaddy 要求提交时,将此 server.csr 文件提供给他们。一些批准后,他们将返回您的证书文件。
获得证书后,您必须将这些文件添加到 apache 配置文件中
<VirtualHost *:443>
DocumentRoot /var/www/html2 // your document root folder on server
ServerName www.yourdomain.com // your domain
SSLEngine on
SSLCertificateFile /path/to/certificate.crt // certificate file
SSLCertificateKeyFile /path/to/private.key // your private file
SSLCertificateChainFile /path/to/DigiCertCA.crt // CA bundle file
</VirtualHost>
certificate.crt 和 DigiCertCA.crt 都将由 SSL 提供商提供
这是完整的过程:
https://www.digicert.com/csr-ssl-installation/apache-openssl.htm
http://www.elinuxbook.com/step-by-step-ssl-configuration-in-apache-web-server/
【解决方案2】:
一个稍微简单的解决方案是创建一个弹性负载均衡器,将 Web 服务器添加为其目标组,通过 Amazon Certificate Manager 订购免费证书,然后将其添加到负载均衡器。