gpt4 book ai didi

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

转载 作者:太空宇宙 更新时间:2023-11-03 12:51:59 25 4
gpt4 key购买 nike

在此先感谢您的帮助。

这是我第一次设置 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

我也有文本格式的。我该如何设置才能通过 HTTPS 访问我的 node.js 应用程序?该应用程序在装有 Ubuntu 13.10 的 EC2 实例上运行,我正在使用 SSH 访问服务器。

跟进问题

所以我仍然遇到错误。以下是相关信息:

/etc/apache2/sites-enabled/forumHTTPSconfig 的内容(sites-enabled 中唯一的文件):

<VirtualHost *:443>
ServerName forum.figma.com
SSLEnable
SSLEngine on
SSLCertificateFile /etc/apache2/forum_figma_com.crt
SSLCertificateKeyFile /home/ubuntu/.ssh/myserver.key
SSLCACertificateFile /etc/apache2/combined-ca.crt
</VirtualHost>

<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>

这是我尝试调用 a2enmod 的输出:

ubuntu@ip-10-190-91-217:/etc/apache2/sites-enabled$ sudo a2enmod forumHTTPSconfig
ERROR: Module forumHTTPSconfig does not exist!
ubuntu@ip-10-190-91-217:/etc/apache2/sites-enabled$ sudo a2enmod mywebsite
ERROR: Module mywebsite does not exist!

知道出了什么问题吗?在此先感谢您的帮助!

最佳答案

首先,请记住有一个您最初用来生成证书的私有(private) key 文件。您将在配置中需要它。

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

    http://nodejs.org/docs/latest/api/https.html

  2. 另一种设置方法是使用 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 和反向代理的信息:

http://wiki.nginx.org/HttpProxyModule

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>

3000 是运行 node.js 服务器的端口。

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

http://httpd.apache.org/docs/2.2/mod/mod_proxy.html

关于ubuntu - 在 EC2 Ubuntu 实例上安装 COMODO EV SSL 证书,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21768097/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com