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

I'm trying to set up default page for my apache2, for following cases:

  1. User is accessing http://IP_Address instead of hostname
  2. Requested protocol (HTTP/HTTPS) is not available (eg. only http*s*://domain.com exists)

Currently I've got something like that

<VirtualHost eserver:80>
        ServerAdmin webmaster@localhost

        DocumentRoot /var/www/local/
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
</VirtualHost>


I think, it works well, i'm trying to do similar thing for HTTPS, but it does not work.

<VirtualHost eserver:443>

       SSLCertificateKeyFile /etc/apache2/ssl/dummy.key
       SSLCertificateFile /etc/apache2/ssl/dummy.crt
       SSLProtocol all
       SSLCipherSuite HIGH:MEDIUM

       ErrorLog /var/log/apache2/error.log
       DocumentRoot /var/www/local/

       # Possible values include: debug, info, notice, warn, error, crit,
       # alert, emerg.
       LogLevel warn

       ServerSignature Off

</VirtualHost>

My default is places in sites-enabled as a first one 000-default
I do not care about not certificate validity during accessing default page, my goal is not show different HTTPS page if user one of points is applied

share|improve this question

2 Answers 2

Em, you don't seem to have a DocumentRoot defined in the HTTPS virtual host. Copy the DocumentRoot and Directory Stanza from the HTTPS virtual host.

share|improve this answer
    
Ups, I added it, but now, when I enter hostname I get that dummy page even if "hostname" has specified HTTPS virtual host –  Ency Jan 6 '11 at 12:27
    
Without knowing the exact OS/Distro you're using, see if "apache2ctl -S" will give you output as to how the vhosts are setup. –  Niall Donegan Jan 6 '11 at 12:35
    
isn't sites-available a debian-based distro thing? –  Michael Lowman Jan 6 '11 at 12:49
    
Well, probably it is, but it changes nothing on my thing, because these config files are included in apache2.conf –  Ency Jan 6 '11 at 12:57
    
Have you got "NameVirtualHost eserver:443" defined? –  Niall Donegan Jan 6 '11 at 13:45
up vote 0 down vote accepted

Dummy directive ServerName can do the trick.

<VirtualHost eserver:443>                                                                            

            ServerName default                                                                         

            SSLEngine on 
            SSLCertificateKeyFile /etc/apache2/ssl/dummy.key                                             
            SSLCertificateFile /etc/apache2/ssl/dummy.crt                                                
            SSLProtocol all
            SSLCipherSuite HIGH:MEDIUM                                                                   

            ErrorLog /var/log/apache2/error.log                                                          

            DocumentRoot /var/www/local/
            # Possible values include: debug, info, notice, warn, error, crit,                           
            # alert, emerg.                                                                              
            LogLevel warn                                                                                

            ServerSignature Off                                                                          

    </VirtualHost>
share|improve this answer

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.