By Tim Larsson
Hi!
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
Thanks!
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!
Create a subdomain.conf and put the content of subdomain inside this file, just let the 000-default.conf with main site.
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.