Trying to setup SSL with Apache on Ubuntu 14.04
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
Solution 1:
Well here's your problem:
<VirtualHost *:433>
Change that into 443.