大网数据广告活动
网站运营与故障问答

Same IP for domain and subdomain

· 52CE 我爱测

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 wa…

问题原文

原帖链接 · Joruus · CC BY-SA 4.0

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?

已采纳解答

原帖链接 · shawty · CC BY-SA 4.0

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"

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Webmasters Stack Exchange
适用范围
以原帖系统、软件版本与发布日期为准(2015-10-07)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。