0

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 https://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

Ency
  • 1,231
  • 1
  • 19
  • 27

2 Answers2

1

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.

Niall Donegan
  • 3,869
  • 20
  • 17
1

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>
Ency
  • 1,231
  • 1
  • 19
  • 27