【发布时间】:2017-06-06 22:30:06
【问题描述】:
我想创建自己的自签名 SSL 证书并将其添加到本地 Apache2 实例(即将 http://localhost/ 更改为 https://localhost/)。但是,我对在 default-ssl.conf 文件中的服务器 IP 下放置什么内容感到困惑。我指的是this resource 来创建 SSL 证书。我尝试将“127.0.0.1”、“localhost”和私有 IP 地址(在本例中为 10.0.2.15)放在“ServerName”部分下。但是,它仍然失败并出现以下错误。
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
(13) Permission denied: make_sock: could not bind to addres 0.0.0.0:80
no listening sockets available, shutting down
任何人都可以就出了什么问题提供一些提示吗?我没有想法(或谷歌的东西)为什么服务器名称是错误的......
我的 default-ssl 文件的前几行:
<IfModule mod_ssl.c>
<VirtualHost _default_:443>
ServerAdmin temp@temp.com
ServerName localhost
【问题讨论】:
-
你可以忽略
ServerName的警告。另一个错误表明您已经有其他一些使用端口 80 的 Web 服务。您是否已经在系统上运行了 nginx? -
我刚刚google了一下,发现nginx...我需要停止它来启用SSL吗?
-
不能设置两个服务监听同一个端口。在两台服务器之一上禁用 :80。关于ServerName 方便设置为你的证书选择的主机名
-
对于自签名证书,尤其是无论如何通过 localhost 访问时,不匹配并不重要。如果使用 localhost 进入,无论如何它们都需要成为第一个找到 80/443 的
VirtualHost,因为在 URL 中使用 localhost 时基于名称的虚拟主机不起作用,并且将首先使用VirtualHost作为端口。 -
我已经添加了我的 default-ssl 文件代码的前几行。 ServerName 在顶部设置为 localhost 但不知道为什么它不起作用。我没有端口 80 的 VirtualHost 部分。我应该添加它吗?