PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, September 21, 2022

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

 September 21, 2022     apache, ports, virtualhost     No comments   

Issue

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 myemail@gmail.com
    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.



Answered By - E.A.T
Answer Checked By - Katrina (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing