0

I have a problem connecting to my https, but not my http.

This is the error I receive "SSL_ERROR_RX_RECORD_TOO_LONG". I also tried

Listen 443 https 

from other suggestions. What am I doing wrong?

Here is the version I have of Raspbian: Raspbian Stretch Lite Minimal image based on Debian Stretch Version: November 2017 Release date: 2017-11-29 Kernel version: 4.9

pi@raspberrypi:~ $ netstat -tln
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN
tcp6       0      0 :::22                   :::*                    LISTEN
tcp6       0      0 :::443                  :::*                    LISTEN
tcp6       0      0 :::80                   :::*                    LISTEN

It looks like my raspbian is only listening on IPV6. I turn off the redirect and the website will load with http(port 80) just fine.

# Redirect / https://www.website.com/

etc/apache2/sites-available/000-default.conf

<VirtualHost *:80>

ServerName website.com
ServerAlias www.website.com
DocumentRoot /var/www/html

Redirect / https://www.website.com/

RewriteEngine on
RewriteCond %{SERVER_NAME} =www.website.com [OR]
RewriteCond %{SERVER_NAME} =website.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]
</VirtualHost>

etc/apache2/sites-available/000-default.conf

<IfModule mod_ssl.c>
    <VirtualHost *:443>
        ServerAdmin webmaster@localhost

        DocumentRoot /var/www/ssl

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        SSLCACertificateFile /etc/apache2/certs/09_01_2017/ca-bundle-client.crt
        SSLCertificateFile /etc/apache2/certs/09_01_2017/website.crt
        SSLCertificateKeyFile /etc/apache2/private/private.key

        <FilesMatch "\.(cgi|shtml|phtml|php)$">
            SSLOptions +StdEnvVars
        </FilesMatch>
        <Directory /usr/lib/cgi-bin>
            SSLOptions +StdEnvVars
        </Directory>
    </VirtualHost>
</IfModule>

etc/apache2/sites-enabled/000-default.conf

<VirtualHost *:80>

ServerName website.com
ServerAlias www.website.com
DocumentRoot /var/www/html

Redirect / https://www.website.com/

</VirtualHost>

/etc/apache2/ports.conf

Listen 80
Listen 443
0

All I had to do was use these 2 commands:

sudo a2enmod ssl
sudo a2ensite default-ssl

Then everything worked! I hope this helps someone else!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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