0

We recently deployed our new website and when trying to use it over SSL with cloudflare, it redirects to the Apache root dir?

I generated origin TLS certificates and downloaded those from cloudflare for the domain and then configured the virtual host to use SSL:

<VirtualHost *:443>


       ServerAdmin webmaster@domain.com
        ServerName domain.com
        ServerAlias www.domain.com
        DocumentRoot /home/domain/public_html
        SSLEngine on
        SSLCertificateFile /etc/apache2/cert/domain.com.pem
        SSLCertificateKeyFile /etc/apache2/cert/domain.com.key
        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

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

</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

I've tried cloudflares flexible, full and strict SSL setting.

But for some reason, it still goes to the default dir of apache?

I just cannot grasp why.

0

This might be caused by one of the following reasons:

  1. Simply Cloudflare cache or Apache needs restart after changes and you forgot to
  2. Make sure of the origin certificate is valid as if it's invalid Apache will redirect on the first virtual host it can find in the config files
  3. This virtual host isn't in place where Apache can process like you forgot to include this file in the main conf file
  4. There is a duplicate virtual host with the root dir path and the same server_name as this one
1
  • Still no dice. I've redone the certificates from cloudflare, copy pasted the keys into .pem and .key text files. Put them in the public_html root as the user owning that catalogue (www-data has access) apache starts fine, but for some freaking reason it redirects to the default page. What's even more strange is that the second site that also uses SSL, configured in the same way redirects to site number 1. So domain1.com > redirects to default root Domain2.com > redirects to domain1.com which then goes to default root. I just cannot understand what the problem is can apache not read pem? – Emil Mar 5 '19 at 10:43

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.