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.
Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.
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