5

I have purchased a SSL certificate from namecheap.com. I am trying to install it on a server running Ubuntu 14.04 and Apache. I used the following tutorial to setup Apache https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-ubuntu-14-04-lts. The server has a pre existing site that is running on HTTP only.

The site makes use of two subdomains admin.example.com and api.example.com so I purchased a wildcard certificate.

I have installed the certificates in accordance to the certificate authority and have modified the Apache config example.com.conf to add the SSL virtual host, I still want the non HTTPS pages to work so I left the existing port 80 config and added the new virtual host host config below.

I restarted Apache and try and view the page via https but get the following error code from firefox (Error code: ssl_error_rx_record_too_long)

I have tried the fixes mentioned in this post with no success https://www.digicert.com/ssl-support/apache-fix-common-ssl-errors.htm#SSLRecordLength

I have also checked that the firewall has port 443 open.

Apache Config

<VirtualHost *:80>
    ServerAdmin [email protected]
    ServerName example.com
    ServerAlias www.example.com api.example.com admin.example.com

    DocumentRoot /var/www/example.com/public/

    <Directory "/var/www/example.com/public/">
            Options Indexes FollowSymLinks
            AllowOverride None
            Order deny,allow
            Allow from all
            Satisfy all

            IndexIgnore */*
            RewriteEngine on
            # if a directory or a file exists, use it directly
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteCond %{REQUEST_FILENAME} !-d

            # otherwise forward it to index.php
            RewriteRule . index.php
    </Directory>

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

    #ErrorLog "/var/www/example.com/protected/runtime/apache-error.log"
    #CustomLog "/var/www/example.com/protected/runtime/access.log" common

</VirtualHost>

<VirtualHost *:433>

#SSL certificate
        SSLEngine On
        SSLCertificateFile /etc/apache2/ssl/STAR.example.com.crt
        SSLCertificateKeyFile /etc/apache2/ssl/*.example.com.key
        SSLCACertificateFile /etc/apache2/ssl/STAR.example.com.ca-bundle.crt

    ServerAdmin [email protected]
    ServerName example.com
    ServerAlias www.example.com api.example.com admin.example.com

    DocumentRoot /var/www/example.com/public/

    <Directory "/var/www/example.com/public/">
            Options Indexes FollowSymLinks
            AllowOverride None
            Order deny,allow
            Allow from all
            Satisfy all

            IndexIgnore */*
            RewriteEngine on
            # if a directory or a file exists, use it directly
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteCond %{REQUEST_FILENAME} !-d

            # otherwise forward it to index.php
            RewriteRule . index.php
    </Directory>

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

    ErrorLog "/var/www/example.com/protected/runtime/apache-error.log"
    CustomLog "/var/www/example.com/protected/runtime/access.log" combined

</VirtualHost>

Apache Details

$ apache2 -v
Server version: Apache/2.4.7 (Ubuntu)
Server built:   Jul 22 2014 14:36:38

1 Answer 1

6

Well here's your problem:

<VirtualHost *:433>

Change that into 443.

2
  • Thank you so much, I have been looking at that config for hours and never noticed the port was wrong. Sometimes all you need is a second set of eyes.
    – Levi Putna
    Commented Dec 28, 2014 at 10:27
  • 3
    Teun Vink, always planned to accept your answer, you just answered the question so quickly I was required to wait before I was allowed to accept. StackExchange thing.
    – Levi Putna
    Commented Jan 3, 2015 at 5:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .