Apache not redirecting from SSL

Hey all

I have a Ubuntu server on which sailjs is installed. In order for me to use this backend from another site I need to have the connection encrypted (https). I followed this tutorial.

With sailsjs I need to reroute any incomming connections to which I have done and that works. So after following the tutorial the plain http still works but pointing to the https version just returns the default apache2 screen.

I am not very knowledgeable with these things so it could probably be something stupid. In the code my actual IP has been changed to Please find my configurations attached.

 <VirtualHost *:80>

        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/projectName/
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        <Directory /var/www/projectName/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
                RewriteEngine on

                # Don't rewrite files or directories
                RewriteCond %{REQUEST_FILENAME} -f [OR]
                RewriteCond %{REQUEST_FILENAME} -d
                RewriteRule ^ - [L]

                # Rewrite everything else to index.html
                # to allow html5 state links
                RewriteRule ^ index.html [L]
                AllowOverride All

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

        ProxyRequests Off

        <Proxy *>
                Order deny,allow
                Allow from all

        ProxyPass /
        ProxyPassReverse /

        Redirect "/" ""
 <IfModule mod_ssl.c>
        <VirtualHost _default_:443>

                DocumentRoot /var/www/html

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

                SSLEngine on

                SSLCertificateFile      /etc/ssl/certs/apache-selfsigned.crt
                SSLCertificateKeyFile /etc/ssl/private/apache-selfsigned.key

                #SSLCertificateChainFile /etc/apache2/ssl.crt/server-ca.crt

                #SSLCACertificatePath /etc/ssl/certs/
                #SSLCACertificateFile /etc/apache2/ssl.crt/ca-bundle.crt

                #SSLCARevocationPath /etc/apache2/ssl.crl/
                #SSLCARevocationFile /etc/apache2/ssl.crl/ca-bundle.crl

                #SSLVerifyClient require
                #SSLVerifyDepth  10

                #SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire
                <FilesMatch "\.(cgi|shtml|phtml|php)$">
                             SSLOptions +StdEnvVars
                <Directory /usr/lib/cgi-bin>
                                SSLOptions +StdEnvVars

                 BrowserMatch "MSIE [2-6]" \
                                nokeepalive ssl-unclean-shutdown \
                                downgrade-1.0 force-response-1.0


Please let me know if any other files are required. Thanks

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
July 17, 2019
Accepted Answer


As far as I can see what could be causing the issue here are two things:

  • the fact that in your HTTP Vhost you have DocumentRoot set to /var/www/projectName/ and in your HTTPS Vhost the DocumentRoot is set to the default one: /var/www/html/ - though this is highly unlikely to be the problem, but you could try channing that.

  • And the more important thing is the fact that you don’t have your Proxy rules in the HTTPS VHost.

You need to make sure that you have the following rules copied to your HTTPS Vhost as well:

        ProxyRequests Off

        <Proxy *>
                Order deny,allow
                Allow from all

        ProxyPass /
        ProxyPassReverse /

        Redirect "/" ""

Hope that this helps! Bobby

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel