Search code examples
apachevirtualhostports

Why https:// and http//:443 works, but http does not with SSLEngine on?


I'm trying to allow HTTP and HTTPS on a VirtualHost within Ubuntu/Debian. I am using the default snakeoil certificates and I am getting the following errors when SSLEngine is on. My servername is linuxturnkeylamp, I have no idea how .Belkin is being added but am using a Belkin router for internet access.

[Tue Jul 07 20:13:21 2015] [warn] RSA server certificate CommonName (CN) `linuxturkeylamp.Belkin' does NOT match server name!?
[Tue Jul 07 20:13:21 2015] [error] python_init: Python version mismatch, expected '2.7.2+', found '2.7.3'.
[Tue Jul 07 20:13:21 2015] [error] python_init: Python executable found '/usr/bin/python'.
[Tue Jul 07 20:13:21 2015] [error] python_init: Python path being used '/usr/lib/python2.7/:/usr/lib/python2.7/plat-linux2:/usr/lib/python2.7/lib-tk:/usr/lib/python2.7/lib-old:/usr/lib/python2.7/lib-dynload'.
[Tue Jul 07 20:13:21 2015] [notice] mod_python: Creating 8 session mutexes based on 150 max processes and 0 max threads.
[Tue Jul 07 20:13:21 2015] [notice] mod_python: using mutex_directory /tmp 
[Tue Jul 07 20:13:21 2015] [warn] RSA server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)

The apache2.conf has ServerName linuxturnkeylamp, and aside a default virtualhost and one for phpmyadmin, my only other is...

<VirtualHost localdrupal.mydomain.com:*>
    DocumentRoot //home/myuser/mydomain/mydomain
    ServerName localdrupal.mydomain.com
    ServerAlias localdrupal.mydomain.com
    ServerAdmin [email protected]
    Alias /mobile "//home/myuser/mydomain/projectpath/www"
    Alias /mobile-app/plugins "//home/myuser/mydomain/cordova/cordova-mydomain/plugins"
    Alias /mobile-app "//home/myuser/mydomain/projectpath/www"
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    <Directory //home/myuser/mydomain/mydomain>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all
    </Directory>
    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
        AllowOverride None
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all
    </Directory>
    ErrorLog ${APACHE_LOG_DIR}/error.log
    LogLevel warn
    CustomLog ${APACHE_LOG_DIR}/ssl_access.log combined

    SSLEngine on
    SSLCertificateFile    /etc/ssl/certs/ssl-cert-snakeoil.pem
    SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key

    <FilesMatch "\.(cgi|shtml|phtml|php)$">
        SSLOptions +StdEnvVars
    </FilesMatch>
    <Directory /usr/lib/cgi-bin>
        SSLOptions +StdEnvVars
    </Directory>
    BrowserMatch "MSIE [2-6]" \
        nokeepalive ssl-unclean-shutdown \
        downgrade-1.0 force-response-1.0
    BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
</VirtualHost>

My /etc/hosts include..

127.0.0.1 linuxturnkeylamp
192.168.56.100  localdrupal.tripchi.com

As is, https://... displays a static image as well as when requesting with http://localdrupal.mydomain.com:443/image.png. However, when requesting http://localdrupal.mydomain.com/image.png i get....

Bad Request

Your browser sent a request that this server could not understand. Reason: You're speaking plain HTTP to an SSL-enabled server port. Instead use the HTTPS scheme to access this URL, please.

If i change to SSLEngine off, HTTPS says SSL connection error and HTTP displays the image.

What am i doing wrong? Does my default virtualhost have to include anything about SSL? It currently does not.


Solution

  • It appears the problem was AllowOverride None needed to be AllowOverride All in the project's directory specification for the 443 virtualhost.