为我在Ubuntu Ec2上运行的站点启用HTTPS

时间:2018-03-05 07:29:59

标签: angularjs amazon-ec2 https ubuntu-16.04

我在Godaddy有一个域名。 该网站在AngularJS中开发,并在Ubuntu 16 EC2中托管。 我在godaddy中使用EC2 IP地址指向了域,并且它工作正常。 需要帮助为我的网站配置HTTPS。

2 个答案:

答案 0 :(得分:0)

首先,您需要从像GoDaddy这样的SSL提供商那里购买SSL证书。要获得SSL,您必须提供.csr文件。

在命令

下生成CSR和私钥文件
public class Scope {

public class Scope {
   static void newScope (int x) {
        // y visible to method only
        int y = 20;
        System.out.println("x and y: " + x + " " + y);
        // this is the local x, it came from the the main function
        // but is a local copy
        x = y * 2;
    }

    public static void main(String args[]) {
        // visible to whole main()
        int x = 10; //known to all code within main

        if (x == 10) {
            newScope (x);
        }

        // y is not visible here (this is alien to the newScope Method)
        // x is visible but unmodified
        System.out.println("x is: " + x);
    }
}

当他们要求提交时,将此server.csr文件提供给SSL Provider / GoDaddy。经过一些批准后,他们会返回证书文件。

获得证书后,您必须在apache配置文件中添加这些文件

openssl req –new –newkey rsa:2048 –nodes –keyout private.key –out server.csr

<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将由SSL提供商提供

这是完整的过程:

https://www.digicert.com/csr-ssl-installation/apache-openssl.htm

http://www.elinuxbook.com/step-by-step-ssl-configuration-in-apache-web-server/

答案 1 :(得分:0)

稍微简单的解决方案是创建弹性负载balanacer,将Web服务器添加为其目标组,通过Amazon证书管理器订购免费证书,并将其添加到负载均衡器。