<VirtualHost www.tsingfun.com:80>
RewriteEngine on
#自动跳https
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R=301]
ServerName www.tsingfun.com
ServerAdmin service@tsingfun.com
DocumentRoot /var/www/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
...
第一行匹配改为*,即:<VirtualHost *:80> 解决。原因是某些Apache2版本Host只能用通配符*,然后匹配里面的ServiceName,而非根据Host中名字匹配。