在EC2 Ubuntu实例上安装COMODO EV SSL证书

在EC2 Ubuntu实例上安装COMODO EV SSL证书,ubuntu,ssl,https,amazon-ec2,Ubuntu,Ssl,Https,Amazon Ec2,提前感谢您的帮助 这是我第一次设置HTTPS,我刚从Comodo获得了证书,但不知道如何使用它。证书以.zip文件形式提供,其中包含以下文件: Root CA Certificate - AddTrustExternalCARoot.crt Intermediate CA Certificate - COMODOAddTrustServerCA.crt Intermediate CA Certificate - COMODOExtendedValidationSecureServerCA.crt

提前感谢您的帮助

这是我第一次设置HTTPS,我刚从Comodo获得了证书,但不知道如何使用它。证书以.zip文件形式提供,其中包含以下文件:

Root CA Certificate - AddTrustExternalCARoot.crt
Intermediate CA Certificate - COMODOAddTrustServerCA.crt
Intermediate CA Certificate - COMODOExtendedValidationSecureServerCA.crt
Your COMODO EV SSL Certificate - forum_linma_com.crt
我也有文本格式的。我如何设置它,使我的node.js应用程序可以通过HTTPS访问?这个应用程序运行在一个带有Ubuntu 13.10的EC2实例上,我正在使用SSH访问服务器

后续问题

所以我还是犯了个错误。以下是相关信息:

/etc/apache2/sites enabled/forumHTTPSconfig
(站点中唯一启用的文件)的内容:


知道怎么回事吗?提前感谢您的帮助

首先,记住有一个私有的
密钥
文件,您最初用来生成证书。您需要在配置中使用它

  • 一种设置方法是在node.js应用程序上配置HTTPS。您可以在此处找到更多信息:

  • 另一种设置方法是使用apache或nginx为node.js应用程序设置反向代理

  • nginx

    抓取所有文件:

    Root CA Certificate - AddTrustExternalCARoot.crt
    Intermediate CA Certificate - COMODOAddTrustServerCA.crt
    Intermediate CA Certificate - COMODOExtendedValidationSecureServerCA.crt
    Your COMODO EV SSL Certificate - forum_linma_com.crt
    
    并将所有内容连接到forum_linma_com.crt

    下面是一个示例配置:

    server {
        listen       443;
        server_name  yourdomain.com;
    
        ssl                  on;
        ssl_certificate      /path/to/forum_linma_com.crt;
        ssl_certificate_key  /path/to/forum_linma_com.key;
    
        location / {
            proxy_pass  http://localhost:3000;
            proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
            proxy_redirect off;
            proxy_buffering off;
            proxy_set_header        Host            static.example.com;
            proxy_set_header        X-Real-IP       $remote_addr;
            proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
        }
    }
    
    以下是nginx和反向代理的更多信息:

    Apache

    抓取以下内容:

    Root CA Certificate - AddTrustExternalCARoot.crt
    Intermediate CA Certificate - COMODOAddTrustServerCA.crt
    Intermediate CA Certificate - COMODOExtendedValidationSecureServerCA.crt
    
    并将其所有内容连接到一个文件中:
    combined-ca.crt

    这是一个示例配置:

    <VirtualHost 0.0.0.0:443>
       ServerName mydomain.com
       SSLEnable
       SSLEngine on
       SSLCertificateFile /path/to/forum_linma_com.crt
       SSLCertificateKeyFile /path/to/forum_linma_com.key  
       SSLCACertificateFile /path/to/combined-ca.crt
    
    <IfModule mod_proxy.c>
        <Proxy *>
          SSLProxyEngine on
          Order deny,allow
          Allow from all
        </Proxy>
    
        RewriteEngine on
    
        ProxyPass / https://127.0.0.1:3000
        ProxyPassReverse /http://127.0.0.1:3000
    </IfModule>
    
    </VirtualHost>
    
    
    ServerName mydomain.com
    可耻的
    斯伦金安
    SSLCertificateFile/path/to/forum\u linma\u com.crt
    SSLCertificateKeyFile/path/to/forum\u linma\u com.key
    SSLCACertificateFile/path/to/combined-ca.crt
    SSLProxyEngine打开
    命令拒绝,允许
    通融
    重新启动发动机
    ProxyPass/https://127.0.0.1:3000
    ProxyPassReverse/http://127.0.0.1:3000
    
    3000
    是运行node.js服务器的端口

    以下是有关Apache和反向代理的更多信息:


    这只是@AaronClayton Dunn的澄清

    我是否应该将示例配置添加到apache2.conf的末尾

    由于您使用的是Ubuntu,通常的过程是创建一个文件:
    /etc/apache2/sites enabled/mywebsite
    ,并将示例内容放在那里

    要启用它,您可以运行:

    sudo a2dismod default
    sudo a2enmod mywebsite
    sudo service apache2 restart
    
    它真的应该是0.0.0.0:443还是我应该输入实际的IP地址

    您可以使用0.0.0.0或*(星型),这基本上告诉它监听服务器上的任何地址。除非您想限制对web服务器的访问,否则无需设置特定的IP地址,这意味着客户端必须使用特定的IP地址才能连接到您的服务器

    我是否应该更改另外两个地址(ProxyPass、ProxyPassReverse)


    不。这些声明基本上是说,将站点上的所有连接到端口443上的
    /
    的内容转发到HTTP端口3000,这是node.js服务器应该运行的地方。

    非常感谢您的回答,Rico。下面有几个问题——1。我是否应该将示例配置添加到apache2.conf的末尾?2.它真的应该是0.0.0.0:443还是我应该输入实际的IP地址?3.我是否应该更改另外两个地址(ProxyPass、ProxyPassReverse)?谢谢嗨,再次感谢你的帮助。哈哈,刚刚查看了你的个人资料,我们正好住在同一个城镇。不管怎样,当我运行“sudoa2dismoddefault”时,我得到了一个错误:“error:moduledefault不存在!”你知道如何解决这个问题吗?谢谢这很酷,我们是邻居:-)所以基本上
    sudoa2dismoddefault
    是禁用默认的apache站点,当您第一次在Ubuntu上安装apache时就配置了该站点。所以您出现了一个错误,因为它可能已被禁用。您可以通过运行
    ls/etc/apache2/sites enabled/
    进行检查,如果您没有看到默认设置,那么它就没有启用。嗯……我一定是遗漏了什么。/etc/apache2/sites enabled的内容是000-default.conf和我刚刚创建的文件(forumHTTPSconfig),其中包含配置代码。当我运行“sudoa2enmodforumhttpsconfig”时,我得到了相同的错误:“错误:模块forumHTTPSconfig不存在!”再次感谢您的帮助。然后您想要运行的是
    A2Dispatite 000 default
    ,或者您可以删除
    A2Dispatite
    脚本正在执行的链接:
    rm-f/etc/apache2/sites enabled/000 default.conf
    很好,
    A2Dispatite 000 default
    工作正常。下一步是什么?我尝试了
    sudo a2enmod forumHTTPSconfig
    ,得到了通常的错误消息。您是如何从Comodo获得.key文件的?
    <VirtualHost 0.0.0.0:443>
       ServerName mydomain.com
       SSLEnable
       SSLEngine on
       SSLCertificateFile /path/to/forum_linma_com.crt
       SSLCertificateKeyFile /path/to/forum_linma_com.key  
       SSLCACertificateFile /path/to/combined-ca.crt
    
    <IfModule mod_proxy.c>
        <Proxy *>
          SSLProxyEngine on
          Order deny,allow
          Allow from all
        </Proxy>
    
        RewriteEngine on
    
        ProxyPass / https://127.0.0.1:3000
        ProxyPassReverse /http://127.0.0.1:3000
    </IfModule>
    
    </VirtualHost>
    
    sudo a2dismod default
    sudo a2enmod mywebsite
    sudo service apache2 restart