【发布时间】:2015-05-16 11:20:11
【问题描述】:
所以我有一个运行 apache2 v2.4.7 的数字海洋 ubuntu 14.04 服务器。我购买了一个 namecheap .me 域并将其 URL 框架指向 DO 服务器的 IP。到目前为止一切正常。然后我注册了一个免费的 StartSSL 证书(注册到 .me 域名),并通过this tutorial 将其添加到服务器,我唯一没有做的就是将 VirtualHost 80 和 443 保存在同一个文件中。我将 443 放在它自己的 default-ssl.conf 文件中。
现在,如果我转到http://123.123.123.123 或http://www.myexample.me,它工作正常。如果我转到https://123.123.123.123(端口 443 ssl 虚拟主机),它可以工作,但它会警告我,因为证书已注册到 www.myexample.me,很好。
最后,如果我转到https://www.myexample.me,它什么也不做,除了 chrome javascript 控制台中的这个
GET https://www.myexample.me/ net::ERR_CONNECTION_REFUSED
这是我的 default-ssl.conf 文件
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerAdmin webmaster@localhost
ServerName myexample.me:443
DocumentRoot /var/www/html
SSLEngine on
SSLProtocol all -SSLv2
SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM
SSLCertificateFile /etc/apache2/ssl/ssl.crt
SSLCertificateKeyFile /etc/apache2/ssl/private.key
SSLCertificateChainFile /etc/apache2/ssl/sub.class1.server.ca.pem
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
<Directory /usr/lib/cgi-bin>
SSLOptions +StdEnvVars
</Directory>
BrowserMatch "MSIE [2-6]" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
</VirtualHost>
</IfModule>
当我在添加证书后重新加载 apache 时。我收到了这个错误。
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
所以我在 apache2.conf 文件的底部添加了Servername myexample.me,这似乎抑制了错误。
感谢任何指导。如果我错过了发布任何信息,请告诉我。
【问题讨论】:
-
在启动 apache http 服务器时听起来好像你的虚拟主机配置没有被读取。
-
@arkascha 我不确定你的意思。我将如何确定正在加载哪些配置文件。我只是在启用站点的文件夹中仅使用 default-ssl 进行了尝试。没有改变。我不知道还能怎么做。
-
啊,抱歉,偶然发现了一个细节:您的配置可能已被读取,但这是错误的:
ServerName myexample.me:443将您的端口号放在那里,应该是:ServerName myexample.me -
嘿,再次感谢您的回复,但删除端口并没有改变任何东西。任何其他建议表示赞赏
-
添加
ServerAlias www.myexample.me指令是否有效?
标签: apache http ubuntu ssl https