我已经build立了一个Ubuntu的(14.04.2)apache2(2.4.7)服务器的SSL,但似乎没有find证书。 Ubuntu运行在具有静态IP的EC2实例上,启用了443端口,域名为theaudioserver.com,DNSlogging为该静态IP。 以下是我如何设置我的服务器:
openssl genrsa 2048 > privatekey.pem openssl req -new -key privatekey.pem -out csr.pem server.crt和server_bundle.crt ssl.conf文件,该文件configuration为SSL: SSLStaplingCache shmcb:/tmp/stapling_cache(128000) <VirtualHost *:443> SSLCipherSuite EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH SSLProtocol All -SSLv2 -SSLv3 SSLHonorCipherOrder On Header always set Strict-Transport-Security "max-age=63072000; includeSubdomains; preload" Header always set X-Frame-Options DENY Header always set X-Content-Type-Options nosniff SSLCompression off SSLUseStapling on ServerName theaudioserver.com SSLEngine on SSLCertificateFile /home/ubuntu/certs/server.crt SSLCertificateKeyFile /home/ubuntu/certs/privatekey.pem SSLCertificateChainFile /home/ubuntu/certs/server_bundle.crt DocumentRoot /var/www/html/ </VirtualHost>
sudo a2enmod ssl添加SSL sudo netstat -anp | grep apache sudo netstat -anp | grep apache给出: tcp6 0 0 :::443 :::* LISTEN 3138/apache2 但是当我testing我的域名时,证书似乎没有被发现。
在ssllabs.com上,我收到了在theaudioserver.com上No SSL certificates were found on theaudioserver.com. Make sure that the name resolves to the correct server and that the SSL port (default is 443) is open on your server's firewall No SSL certificates were found on theaudioserver.com. Make sure that the name resolves to the correct server and that the SSL port (default is 443) is open on your server's firewall 。
当通过https://52.24.39.220访问服务器时,我得到一个名称不匹配的错误,因为我没有通过域名访问,但这表明EC2上的服务器防火墙似乎设置正确。
我在这里做错了什么?
我没有得到任何连接到您的服务器端口443感觉就像一个防火墙问题。 您是否在您的EC2安全组防火墙中打开了端口443? 你在主机的防火墙中打开过吗?
更新;
您的DNS设置不正确
dig +short theaudioserver.com 52.25.39.220
而你说你可以通过52 24 .39.220连接。
在您网站的根目录中使用.htaccess文件,将非安全端口上的请求redirect到安全端口,即http:// – > https://
该文件应该包含这样的东西:
RewriteEngine on RewriteCond %{SERVER_PORT} !^443$ RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]
您需要在sites-available编辑default sites-available来包含:
DocumentRoot /var/www/html <Directory /> Options FollowSymLinks AllowOverride All </Directory> <Directory /var/www/html> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory>
这允许.htaccess工作在该目录和所有包含的目录,因此您的整个网站。