在 Apache 中设置 SSL 虚拟主机

在 Apache 中设置 SSL 虚拟主机

我正在尝试在 Apache 中设置带有 SNI 的 SSL,并且在访问网站时在 Firefox 中收到常见的“ssl_error_rx_record_too_long”错误(https://test.me.dev.xxxx.net),从中我可以得出结论,服务器正在监听端口 443,但不知道在其上使用 SSL。

服务器是 Ubuntu 9.04,带有 Apache 2.2.11,我以默认方式启用了 SSL(a2enmod ssl)。

这是我的相关配置:

NameVirtualHost *:*
Listen 80

<IfModule mod_ssl.c>
    Listen 443
</IfModule>

...

<VirtualHost *:*>

        DocumentRoot /home
        ServerAlias *.dev.xxxx.net
        UseCanonicalName Off
        # project.user.dev.xxxx.net
        VirtualDocumentRoot /home/%2/dev/%1/web

        SSLEngine On
        SSLCertificateFile /etc/apache2/certs/dev.crt
        SSLCertificateKeyFile /etc/apache2/certs/dev.key

</VirtualHost>

怎么了?

答案1

这是我的服务器工作配置的一部分。希望它对你有用。

<VirtualHost *:80>
    ServerAdmin [email protected]
    ServerName  xxx.com
    ServerAlias www.xxx.com

    DocumentRoot /srv/www/htdocs/xxx.com

    ErrorLog  /var/log/apache2/xxx.com-error_log
    CustomLog /var/log/apache2/xxx.com-access_log vhost_common

    <Directory "/srv/www/htdocs/xxx.com">
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

<VirtualHost *:80>
    ServerName mail.xxx.com
    Redirect / https://mail.xxx.com/
</VirtualHost>

<IfDefine SSL>
<IfDefine !NOSSL>
<VirtualHost _default_:443>
    ServerAdmin [email protected]
    ServerName  mail.xxx.com

    DocumentRoot  /srv/www/htdocs/roundcube

    ErrorLog  /var/log/apache2/roundcube-error_log
    CustomLog /var/log/apache2/roundcube-access_log vhost_common
    CustomLog /var/log/apache2/roundcube-ssl_log ssl_combined

    SSLEngine on
    SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
    SSLCertificateFile    /etc/ssl/xxx/apache2.crt
    SSLCertificateKeyFile /etc/ssl/xxx/apache2.key
    SetEnvIf User-Agent ".*MSIE.*" \
        nokeepalive ssl-unclean-shutdown \
        downgrade-1.0 force-response-1.0
</VirtualHost>
</IfDefine>
</IfDefine>

答案2

<VirtualHost *:443>
</VirtualHost>

相关内容