Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have the following configuration:

<VirtualHost 123.0.1.2:80>
ServerName website.com
DocumentRoot "/var/www/website.com"
RewriteEngine   on
RewriteCond     %{SERVER_PORT} ^80$
RewriteRule     ^(.*)$ https://%{SERVER_NAME}$1 [L,R]
</VirtualHost>

<VirtualHost 123.0.1.2:443>
DocumentRoot "/var/www/website.com"
ServerName website.com
SSLEngine on
SSLCertificateFile /var/ssl/testing/server.crt
SSLCertificateKeyFile /var/ssl/testing/server.key
<Directory "/var/www/website.com">
allow from all
Options +Indexes
</Directory>
SSLVerifyClient none
</VirtualHost>

However this gives me an SSL protocol error, which I don't get if I remove the first VirtualHost.

Cheers

share|improve this question

1 Answer 1

up vote 1 down vote accepted

You need to add NameVirtualHost.

Try to add the following

NameVirtualHost 123.0.1.2:80
NameVirtualHost 123.0.1.2:443

More information:

http://httpd.apache.org/docs/2.2/vhosts/name-based.html

share|improve this answer
    
That gives me [warn] NameVirtualHost 123.0.1.2:443 has no VirtualHosts –  Dean Aug 16 '12 at 11:35
    
Check here and make sure your configuration is proper. wiki.apache.org/httpd/CommonMisconfigurations –  pkhamre Aug 16 '12 at 11:41
    
Umm, yeah, I don't see any problems with mine. New version is here: pastebin.com/TZXfQYTd –  Dean Aug 16 '12 at 11:44
    
Just to make sure, you have Listen-directives for both ports? –  pkhamre Aug 16 '12 at 11:47
    
Yes, Listen *:443 Listen *:80 –  Dean Aug 16 '12 at 11:54

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.