Join 1M+ other developers and:
- Get help and share knowledge in Q&A
- Subscribe to topics of interest
- Get courses & tools that help you grow as a developer or small business owner
Subdomain is displaying main site after adding SSL
I have a domain example.com which is working great. I’ve added a subdomain - subdomain.example to it, but the subdomain is displaying either the mainsite (example.com) or after messing around with 000-default.conf gives me 404. The only way to access it is to go ->subdomain.example.com/subdomainname. This happened after configuring SSL and switching the ports to 443 in my 000-default.conf file.
When I was using port 80 everything was working great.
I’ve tried to mess around with my 000-default.conf and apache2.conf but I just can’t figure out how to get my subdomain.example.com to show its content.
The only directory that seems reachable is my /var/www/html , there I have my main site and a folder (subdomainname) with my subdomain content. I don’t know if its worth to mention, but my subdomain is supposed to run a .php application while my main directory is running a html site.
I’m using Cloudflare and have the DNS set up there as follows:
A Name: example.com Value: IP
CNAME Name: subdomain Value: example.com
CNAME Name: www Value: example.com
Please help - I’ve been trying for 3 days now just looping around.
My 000-default.conf :
<VirtualHost *:443> ServerName www.example.com DocumentRoot /var/www/html SSLEngine on SSLCertificateFile /var/www/ssl/origin.pem SSLCertificateKeyFile /var/www/ssl/private.key </VirtualHost> <VirtualHost *:443> ServerName subdomain.example.com DocumentRoot /var/www/html SSLEngine on SSLCertificateFile /var/www/ssl/origin.pem SSLCertificateKeyFile /var/www/ssl/private.key </VirtualHost> <Directory "/var/www"> Options +FollowSymLinks AllowOverride All </Directory> # vim: syntax=apache ts=4 sw=4 sts=4 sr noet