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!
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
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.