简体   繁体   English

Apache2 SSL设置适用于静态IP,但不适用于域名

[英]Apache2 SSL setup works with Static IP but not with domain name

So I have a digital ocean ubuntu 14.04 server that is running apache2 v2.4.7. 所以我有一个运行apache2 v2.4.7的数字海洋ubuntu 14.04服务器。 I bought a namecheap .me domain and pointed it's URL Frame to the IP of the DO server. 我买了一个namecheap .me域,并将其URL框架指向DO服务器的IP。 Everything works so far. 到目前为止一切正常。 I then signed up for a free StartSSL certificate (that's registered to the .me domain name), and added it to the server via this tutorial , the only thing I didnt do exactly was keep both VirtualHost 80 and 443 in the same file. 然后,我注册了免费的StartSSL证书(已注册到.me域名),并通过本教程将其添加到服务器中,我唯一没有做的就是将VirtualHost 80和443保留在同一文件中。 I put 443 in its own default-ssl.conf file. 我将443放在其自己的default-ssl.conf文件中。

Now, if I go to http://123.123.123.123 or http://www.myexample.me it works fine. 现在,如果我转到http://123.123.123.123http://www.myexample.me它可以正常工作。 If I go to https://123.123.123.123 (the port 443 ssl virtualhost), it works, but it warns me because the certificate is registered to www.myexample.me, fine. 如果我转到https://123.123.123.123 (端口443 ssl virtualhost),它可以工作,但是警告我,因为证书已注册到www.myexample.me,很好。

Finally, if I go to https://www.myexample.me it does nothing, except this in the chrome javascript console 最后,如果我转到https://www.myexample.me则不会执行任何操作,但在chrome JavaScript控制台中除外

GET https://www.myexample.me/ net::ERR_CONNECTION_REFUSED

This is my default-ssl.conf file 这是我的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>

When I reloaded apache after adding the certs. 当我添加证书后重新加载apache时。 I was receiving this error. 我收到此错误。

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

So I added Servername myexample.me to the bottom of the apache2.conf file, which seemed to suppress the error. 因此,我在apache2.conf文件的底部添加了Servername myexample.me ,这似乎可以抑制该错误。

Any guidance is appreciated. 任何指导表示赞赏。 Let me know if I missed posting any information. 让我知道是否错过发布任何信息。

So I was able to fix it, pretty dumb mistake but if Ill post it in case anyone else makes the same one. 所以我能够解决它,这是很愚蠢的错误,但是如果我发贴,以防其他人也犯同样的错误。

In namecheap's URLRedirect settings, or whichever provider you might be working with, my URL Redirect settings were set to URLFrame. 在namecheap的URLRedirect设置中,或者无论您使用的是哪个提供程序,我的URL重定向设置都设置为URLFrame。 But they should have been set to A (Address). 但是应该将它们设置为A(地址)。

Thanks to everyone that helped. 感谢所有提供帮助的人。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM