【问题标题】:(98)Address already in use: make_sock: could not bind to address [::]:443(98)地址已在使用:make_sock:无法绑定到地址[::]:443
【发布时间】:2014-07-10 08:30:35
【问题描述】:

我正在尝试将我的网站指向 Amazon EC2 实例,以便我能够在 HTTPS 协议上打开。我的网站之前正在运行,但警告说它没有有效的证书,使用此链接示例 https://my.site.name.edu 但现在当我尝试访问该网站时收到“网页不可用”提示。

请注意我有:

在使用 Apache 的 Linux 服务器上为此测试站点安装 Drupal

我的 EC2 实例附加到弹性 IP

使用本指南中的步骤:Creating, Uploading, and Deleting Server Certificates

有效的 CA 签名的 Apache 证书

安装在 /home/ec2-user 文件夹中的 openssl-1.0.1f 文件

使用此链接创建虚拟主机:http://ananthakrishnanravi.wordpress.com/2012/04/15/configuring-ssl-and-https-for-your-website-amazon-ec2/

以下是发生错误的时间,同时尝试解决 HTTPS 访问问题

我尝试更改此链接中的 ssl.conf 文件,看看是否能解决问题:Setup an SSL certificate on an EC2 instance

我复制了一个新的 ssl.conf 文件,注释了旧的 SSLCertificateKeyFile、SSLCertificateFile 和 SSLCertificateChainFile。然后,在编写前四行代码后,我将复制的、修改后的文件粘贴到目录中,如下所示:

<VirtualHost 00.00.00.00:443>
  SSLCertificateKeyFile /home/ec2-user/castestingapache/privatekey.pem
  SSLCertificateFile /home/ec2-user/castestingapache/my_site_name_edu.pem 
  SSLCertificateChainFile /home/ec2-user/castestingapache/my_site_name_edu_interm.crt

但是当我重新启动 Apache 时:

service httpd restart

我收到此错误消息:

Stopping httpd:                                            [FAILED]
Starting httpd: [Wed May 21 14:44:31 2014] [warn] module ssl_module is already loaded,     skipping
(98)Address already in use: make_sock: could not bind to address [::]:443
                                                       [  OK  ]

我的 httpd.conf 是这样设置的:

<VirtualHost 00.00.00.00:443>    #Same as the IP in the ssl.conf#
ServerAdmin ec2-user@ec2-00-00-00-00.compute.amazonaws.com
DocumentRoot /var/www/html
ServerName https://my.site.name.edu
SSLEngine on
SSLProtocol all -SSLv2
SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM
# ErrorLog logs/errorlogs
# CustomLog logs/custom
SSLCertificateFile /home/ec2-user/castestingapache/my_site_name_edu.pem 
SSLCertificateKeyFile /home/ec2-user/castestingapache/privatekey.pem
SSLCertificateChainFile /home/ec2-user/castestingapache/my_site_name_edu_interm.crt
# SSLCACertificateFile /etc/httpd/conf/bundle.txt 
SetEnvIf User-Agent “.*MSIE.*” nokeepalive ssl-unclean-shutdown
# CustomLog /usr/local/apache/logs/ssl_request_log \
# “%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \”%r\” %b”
</VirtualHost>

编辑:我尝试恢复到旧的 ssl.conf,但是当我尝试重新启动 Apache 时,它​​给了我同样的错误。 此问题已解决 我不得不删除其中一个 ssl.conf,即使我已将其重命名...

更新我已将此行添加到 httpd.conf 文件中:

NameVirtualHost 00.00.00.00:443

我认为问题在于我的证书没有指向这个 IP 地址。

更新我刚刚在这里http://ssltool.com/?action=sslCheckOpenSSL 运行了证书安装检查器测试,这就是我得到的:

注意:IP 12-34-56-78 是我在 AWS EC2 实例上的私有 IP 地址。

非常感谢任何帮助。

谢谢,

【问题讨论】:

  • 似乎有些东西已经在使用端口 443。是否有另一个虚拟主机可能正在使用相同的端口,或者您之前是否运行过另一个 Web 服务器?
  • 我们确实有多个站点在 AWS EC2 实例上运行,并打开了入站规则 443 端口范围。这有帮助吗?
  • 对不起!我刚刚删除了旧的 ssl.conf,现在我的网站已备份...但我仍在尝试解决无效的 SSL 证书错误。

标签: apache ssl amazon-web-services amazon-ec2


【解决方案1】:

呃……答案一直在这个链接中……

Setup an SSL certificate on an EC2 instance

ssl.conf 中的这一行:

<VirtualHost 00.000.000.00:443>

不得不改成:

<VirtualHost _default_:443> 

添加其余部分:

SSLCertificateKeyFile /etc/ssl/mydomain_com.key
SSLCertificateFile /etc/ssl/mydomain_com.crt
SSLCertificateChainFile /etc/ssl/mydomain_com.ca-bundle
</VirtualHost>

瞧!您的 HTTPS: 链接应该可以工作...

【讨论】:

    猜你喜欢
    • 2018-03-20
    • 2018-12-05
    • 1970-01-01
    • 1970-01-01
    • 2016-11-11
    • 1970-01-01
    • 2012-12-25
    • 2012-02-26
    • 1970-01-01
    相关资源
    最近更新 更多