我试图让Apache 2在服务器上的许多域之一使用SSL。 我不关心在服务器上运行SSL的任何其他域。 我正在尝试为Facebook应用做这个。 根据http://www.t1shopper.com/tools/port-scan/ ,服务器上没有监听端口443
url是facebook.mythinairwireless.com
我遵循这个指南: http : //www.codealpha.net/631/name-based-virtual-hosts-with-ssl-using-apache2-on-ubuntu-lucid/
当我重新启动Apache,我得到这些日志消息:
[Fri Jan 20 20:23:42 2012] [warn] Init: Name-based SSL virtual hosts only work for clients with TLS server name indication support (RFC 4366) [Fri Jan 20 20:23:42 2012] [warn] Init: Name-based SSL virtual hosts only work for clients with TLS server name indication support (RFC 4366) [Fri Jan 20 20:23:42 2012] [notice] Apache/2.2.14 (Ubuntu) PHP/5.3.2-1ubuntu4 with Suhosin-Patch mod_ssl/2.2.14 OpenSSL/0.9.8k configured -- resuming normal operations
我的ports.conf文件如下所示:
NameVirtualHost *:80 NameVirtualHost *:443 Listen 80 <IfModule mod_ssl.c> # If you add NameVirtualHost *:443 here, you will also have to change # the VirtualHost statement in /etc/apache2/sites-available/default-ssl # to <VirtualHost *:443> # Server Name Indication for SSL named virtual hosts is currently not # supported by MSIE on Windows XP. Listen 443 </IfModule> <IfModule mod_gnutls.c> Listen 443 </IfModule>
而我的网站的configuration文件(除了一些文件path:
<VirtualHost *:443> SSLEngine on SSLCertificateFile obscured ServerName facebook.mythinairwireless.com ServerAdmin webmaster@localhost DocumentRoot /home/obscured/facebook ErrorLog /var/log/apache2/error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog /var/log/apache2/access.log combined </VirtualHost>
端口80的configuration也在这个文件中。
这些只是警告。 由于浏览器支持SNI(服务器名称指示),因此您应该使用SSL支持来处理您的网站。
因此,build议为SSL网站configuration基于IP的虚拟主机,而不是基于名称。
检查ssl模块是否被启用(可能是这个警告)。
apache2 -t -D DUMP_MODULES -f /etc/apache2/apache2.conf
注意在上面的命令中,apache2可能需要被httpdreplace。 最后的文件path应该是主要的apacheconfiguration文件。
您的防火墙也可能会阻塞端口。 下一个命令可以让你看看它是否真的在监听。 如果你没有得到任何回报,那么没有进程正在443上进行监听。
netstat -lpn | grep 443
这是我的整个configuration供参考。
Listen 443 NameVirtualHost *:443 <VirtualHost *:443> ServerName sub.domain.com DocumentRoot /home/www/sub.domain.com/ SSLEngine on SSLCertificateFile /etc/apache2/ssl/sub.domain.com SSLCertificateKeyFile /etc/apache2/ssl/sub.domain.com </VirtualHost>
一些额外的位应该已经与ssl模块一起。
SSLRandomSeed startup builtin SSLRandomSeed startup file:/dev/urandom 512 SSLRandomSeed connect builtin SSLRandomSeed connect file:/dev/urandom 512 SSLPassPhraseDialog builtin SSLSessionCache shmcb:/var/run/apache2/ssl_scache(512000) SSLSessionCacheTimeout 300 SSLMutex file:/var/run/apache2/ssl_mutex SSLCipherSuite HIGH:MEDIUM:!ADH SSLProtocol all -SSLv2