2

My web content is hosted by a different company than my DNS records/domains. Let's call the first content host and the second domain host.

The content hoster uses Plesk (v12 on CentOS 7). I also got a domain there, but I don't want to use it. Let's call this one something.example

My "real" domain at the domain provider is called realthing.example.

Up until now my working setup looked like this: sub1.realthing.example pointed via A-record to IP-Address of something.example. That works. sub2.something.example has content and is working (content is showing in a browser)

What I want to do now: sub3.realthing.example point to sub2.something.example and then show the content of sub2.something.example. I tried to do this with a CNAME entry but what happens is, that sub3.realthing.example shows the content of something.example. Checking the reverse-DNS record with dnswatch.info shows the right setup (sub3.realthing.example CNAME sub2.something.example). So it seems that I need to do this at the content provider side to enable Apache to present the correct content. But I don't know how to do this with plesk.

Old post (same meaning): my domain there is some internal URL (11-43-223-33.customer.company.example). I configured my real domain (mydomain.example) at my domain/dns provider to point to the IP-address (11.43.223.33) of the content server. That works.

Now what I want to do and until now am not able to accomplish: Using a subdomain (sub.mydomain.example) to point to a subdomain at my contenthoster (sub.11-43-223-33.customer.company.example). I used a CNAME entry for that (sub.mydomain.example CNAME sub.11-43-223-33.customer.company.example). Instead of showing the content of sub.11-43-223-33.customer.company.example when opening sub.mydomain.example in a browser I got presented with the content of mydomain.example.

As commented below, there is content behind sub.11-43-223-33.customer.company.example which I can access if I open that URL in a browser. So the subdomain at my content provider is up and running by itself.

Is it even possible to accomplish this with Plesk? Do I need to add sth to the Apache config so that it'll work?

8
  • Do you have the sub-domain defined on the web server?? This may sound silly, however, it has been an answer here more times than not.
    – closetnoc
    Oct 7, 2015 at 13:28
  • Yes... at least if I understand your question correctly: The website on the subdomain sub.11-43-223-33.customer.company.example is up and running, I can open it with that URL in any browser. Only won't work with the CNAME sub.mydomain.example.. that will open the website of mydomain.example instead. I appended that explanation to the topic, thanks.
    – Joruus
    Oct 7, 2015 at 13:50
  • If you change the CNAME to an IP address, does it work?? Some DNS servers do not like CNAMEs thought it is rare. Keep in mind that it takes a while for the new DNS entries to propagate. To avoid this delay in testing, I set my client computer to point to the DNS where the settings are made (usually the registrars DNS with SOA). You can try this trick before making any changes to an IP address just to make sure.
    – closetnoc
    Oct 7, 2015 at 14:01
  • No, that results in the same. That's because I already pointed mydomain.example to the IP-address and now I wish to use a subdomain under the same IP-address. There is no way for the webserver to know that I want to open the subdomain when I just let DNS resolve to the IP address. So I thought "hey, CNAME is the way to go". Perhaps it is just not possible to access a subdomain with another DNS-entry Or I have to use some feature of Apache instead of meddling with DNS?
    – Joruus
    Oct 7, 2015 at 15:01
  • You have to have all websites defined on Apache for it to work. You would have one site for example.com and another for sub-domain.example.com. Otherwise, Apache will not be able to match the request in the request header to a location and often provides the first site defined. Depending upon the OS, Apache will install differently. For example, Redhat will be different than Ubuntu. Using a control panel should make this transparent if you use one. What OS do you have? Are you using a control panel?
    – closetnoc
    Oct 7, 2015 at 15:07

1 Answer 1

1

Check your Web Server configuration.

How you do that via Plesk I can't say because I try to avoid these "Easy Web Control Panels" like the plague.

However, making an assumption that your underlying web server is most likely "Apache", in the virtual host entry in Apaches configuration for the target sub site your trying to access, you must fully alias the sub domain you wish to access.

I'm not near a server that I can use to grab you an example, but I'll come back to this post later today when I return to my office, and document a full virtual name/server set up.

Off the top of my head for now however, your virtual server needs to contain the following 2 lines (among the other options in there):

ServerName www.example.com
ServerAlias mysub.example.com another.example.com

ServerName MUST hold the name source name you wish that site (sub site) to respond to, which in your case I would suspect would be sub2.example.com, you'd then follow that with a ServerAlias line that would contain sub3.example.com

As long as your DNS is resolving the correct public IP address of the server where everything is hosted, the remainder of your configuration will be specific to what you call "Content Host"

3
  • Plesk came with the package and once it's there there is not going back ;) But you 're right, underlying is an Apache webserver and I tried to add ServerName and ServerAlias to the vhost.conf and vhost_ssl.conf: <br>ServerName sub2.something.example <br>ServerAlias sub3.realthing.com<br></script> no change in bahaviour though :(
    – Joruus
    Oct 8, 2015 at 13:30
  • ok, i was too impatient... After clearing every browsercache available to mankind it now works! Thanks a lot!
    – Joruus
    Oct 8, 2015 at 13:39
  • Your welcome Joruus : If I had a penny for every time I'd solved this problem using these 2 little lines I'd be extremely wealthy by now :-) it's by far one of the most common problems I come across when folks try to perform sub site aliasing as you are.
    – shawty
    Oct 8, 2015 at 14:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.