How to correctly setup a subdomain hosted on another host?

I am really bad at explaining things so il just tell you straight out what i have done versus what i expected to happen on two related issues.

Issue one

I have one host hosting the main directory of my website aka. example.com
I wanted to host a subdomain( sub.example(dot)com) on another host, my own pc.

I made the sub directory through cpanel(not needed) went to Cloudflare, added A record for it so that sub points to pc ip.

That showed the apache correctly installed thingy. I pressed “dns and https proxy”(or whatever the yellow cloud says) and now it just shows the offline website Cloudflare page. I am guessing this is temporary maybe, if not how do i fix it.

to summarize issue one. Worked before i switched to dns and https proxy.

Issue two.

How do i correctly make this sub domain show the files that i want it to show, say i want it to show the files in
/sub.example(dot)com/

i made a .conf file. sub.example.conf in conf.d since i saw that there was this Supplemental configuration thing added to the main conf.

in that i added
<VirtualHost *:80>
ServerName sub.example(dot)com
DocumentRoot " /sub.example(dot)com"
<Directory " /sub.example(dot)com/>"
AllowOverride All
Allow from all
Options +Indexes

then i went to pc ip
And that didint change anything. I assume this might be because the sub domain isn’t working with issue one yet but that it could also be something else.
Is this the correct way to make it host the sub domain when issue one eventually works?

If not ELI5.

I am thankful for any input, even if you just call me dumb :wink:

Thanks

  1. Something at your end isn’t responding to Port 443. It could be your ISP, or it could just be your PC. Try setting SSL to Flexible. Looking at your conf info in your post, you’re only configuring for Port 80. Flexible should work.

  2. Dunno, that’s beyond the scope of Cloudflare support. But if you can get it working with that DNS entry set to :grey:, you’re more than halfway to getting it working.

made it listen to :443 as well now but now it brings up Error 526: Invalid SSL certificate.
Shall i just wait until that sorts itself out or do i need to install a certificate on my server or something. i am very clueless to this sort of thing and only installed centos a week ago

Invalid Certificate? If that’s a Cloudflare error due to an improper certificate on your PC, try setting SSL here to Full (not strict). Try it anyhow. Whatever you put on your PC may have installed a self-signed certificate.