Report this

What is the reason for this report?

Subdomain SSL problem

Posted on March 23, 2018
Gas

By Gas

Hello,

I hosted my subdomain on my Ubuntu server running apache2 2.4 However I wan’t the subdomain to be reached over HTTPS however I can only reach it over HTTP when i try HTTPS it just redirects to my main site.

My host file:

code
sites-available# cat sub.redacted.conf
<VirtualHost *:80>
    ServerAdmin root@localhost
    ServerName sub.redacted.com
    ServerAlias www.sub.redacted
    DocumentRoot /var/www/subdomain

    <Directory /var/www/xmrfront>
       Options Indexes FollowSymLinks
       AllowOverride None
       Require all granted
    </Directory>

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

<VirtualHost *:443>
                ServerAdmin root@localhost
                ServerName sub.redacted.com
                ServerAlias www.sub.redacted.com
                DocumentRoot /var/www/subdomain
                ErrorLog ${APACHE_LOG_DIR}/error.log
                CustomLog ${APACHE_LOG_DIR}/access.log combined
                SSLEngine on
                SSLCertificateFile      /root/keys/pub.crt
                SSLCertificateKeyFile   /root/keys/priv.key
                <FilesMatch "\.(cgi|shtml|phtml|php)$">
                                SSLOptions +StdEnvVars
                </FilesMatch>
                <Directory /usr/lib/cgi-bin>
                                SSLOptions +StdEnvVars
        </Directory>
</VirtualHost>

And then there’s also the default-ssl.conf file for my main site SSL which looks like this:

#cat default-ssl.conf
<IfModule mod_ssl.c>
<VirtualHost *:443>
                ServerAdmin root@localhost
                ServerName mainredacted.com
                DocumentRoot /var/www/html
                ErrorLog ${APACHE_LOG_DIR}/error.log
                CustomLog ${APACHE_LOG_DIR}/access.log combined
                SSLEngine on
                SSLCertificateFile      /root/keys/pub.crt
                SSLCertificateKeyFile   /root/keys/priv.key
                <FilesMatch "\.(cgi|shtml|phtml|php)$">
                                SSLOptions +StdEnvVars
                </FilesMatch>
                <Directory /usr/lib/cgi-bin>
                                SSLOptions +StdEnvVars
                </Directory>
        </VirtualHost>
</IfModule>

Any thoughts ? I’m using cloudflare and i’m not doing anything weird like redirecting http or something.



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!

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.

Hello,

The VirtualHost configuration for your subdomain name for port 443 actually looks correct, have you restarted your Apache service after you made the change to the configuration file?

Regards, Bobby

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.