2

We have a hosted website, configurable through cPanel. Content that can't be hosted there (because it requires up-to-date PHP, which is "coming soon") is temporarily on another server. That server has a permanent IP address, but no URL.

What are the cPanel options we need to use to get subdomain.example.com to display content from 203.0.113.0, whilst maintaining the original URL? So e.g. if a user types subdomain.example.com/page, they get content from 203.0.113.0/page, but continue to see subdomain.example.com/page in their browser.

Edit for more info:

The original server is viewed at a URL (say example.com). It is hosted with Zen Internet, and my only editing power is through limited cPanel features. I think it's running Apache. I can add new files. I'm struggling to match cPanel documentation with my experience of e.g. hosting an Apache server from a laptop. (Which is something I've only done a couple of times.)

I can ask our admin to edit DNS records / talk to our hosting provider, but his experience is as limited as mine, so I need to pass along specific instructions. I believe our admin has created a DNS A record which points at the IP address. Unless I add a redirect in cPanel, however, I get sent to a Zen Internet Domain Holding Page. (First I get a "the security certificate is from Zen hosting..." warning, but ignoring that...)

The subdomain server is accessed through a public IP address (say 203.0.113.0:8080). It is an IIS server. It is configured to display the subdomain content if it receives a request from subdomain.example.com, or at port :8080; viewing the site via the IP+port works fine. This server I have full access to.

3
  • Another option might be to use your domain registrar. For example, Godaddy has free redirection services including framed masking: godaddy.com/help/… May 21, 2017 at 9:44
  • You can't do this sort of "redirect" through cPanel if you want the redirect to be "masked". cPanel offers a simple redirect module that is a bit notorious for making a mess at best. What you want is not actually a redirect at all as you'd need to "proxy" the request to the other server - this will require manual changes to your .htaccess and/or server config. OR, you configure an A record in the DNS for the subdomain that points the other server - but you'll need to configure the other server and give it this URL.
    – MrWhite
    May 21, 2017 at 13:47
  • A few questions. Does the sub domain exist or are you going to set it up? Are you really trying g to access the second server using a private IP address? Is your current server also available using a private IP address? Do you have shell access to the computer or a way to create files - assuming you know how to manage file level access through cPanel? What web server are you using? If Apache, are you familiar with Htaccess?
    – closetnoc
    May 22, 2017 at 0:25

1 Answer 1

2

This isn't really a cPanel problem. This is either a problem with your IIS server, or a problem with the amount of access you have.

If your subdomain is being served on port 8080, and you want to view it without having to include the port, then your only option is to either change the port that it is listening on to be port 80, or to redirect traffic through some proxy.

My first thought would be to simply change to port on the IIS server to port 80. If it's serving HTTP content, it should be connecting to the HTTP port, which is port 80. If it's not configured to run on 80, then that host is simply not making your site available as a normal website. (Also, it is assumed that the IIS server will properly access the content by domain name, and if that's not the case, it should be done, too). The obvious answer is simply to modify the IIS server to serve the content from port 80, and then simply change the A record (a DNS record) for subdomain.example.com to be 203.0.113.0. That alone should fix your problem.

If you absolutely cannot modify the IIS server to function over the standard HTTP port, then your next option would be to create a proxy of some sort. One way of doing this is to create a reverse proxy in Apache:

ProxyPass / http://203.0.113.0:8080/
ProxyPassReverse / http://203.0.113.0:8080/

However, to do that, you'll probably need root access on the server as it can't be included in a .htaccess file. If you should be able to add those lines, this article will tell you where you can create the file to be added into the configuration:

https://documentation.cpanel.net/display/EA/Modify+Virtualhost+Containers+With+Include+Files

There's probably other ways to create a proxy as well, including perhaps checking with your domain registrar, etc. Just remember to make the A record for subdomain.example.com match the IP of the server where the redirect is created.

5
  • As I said, the IIS server is configured to display the subdomain content if it receives a request from subdomain.example.com. I think the setup is correct; if not, the source of the problem will be obvious, as it will serve the wrong website.
    – Ollyver
    Jul 2, 2017 at 8:08
  • I think you are right that I need to change the A record, but that I simply don't have access to the right options in cPanel. It sounds like all the "user-friendly" subdomain / redirect / etc options are useless, and I can't change the DNS records using them. Is there a full admin version of cPanel which does have DNS record management, or does our website owner need to contact our domain provider (via website or phone) through a different method?
    – Ollyver
    Jul 2, 2017 at 8:11
  • @Ollyver The IIS server shouldn't just serve content for subdomain.example.com, but also for that from port 80. Port 80 is the important part here, unless you are fine visiting subdomain.example.com:8080. A hostname always resolves to an IP address. Web browses will default to port 80, which is the only reason you don't have to type in domain.com:80. The :80 is assumed. So, if you don't want to type a port number, it would need to listen on port 80.
    – DKing
    Jul 5, 2017 at 13:58
  • @Ollyver Regarding the A records, cPanel makes that pretty simple by default. However, your hosting provider can set any restrictions when they configure your account. Be sure that you don't already have the subdomain added as a subdomain for hosting. You're just creating a new A record. Even the "Simple DNS Zone Editor" should be able to handle that. DNS records are not redirects. You haven't mentioned anything which would require a redirect. A redirect may be helpful once you have your URL working, but not until then. That would be done at the hosting.
    – DKing
    Jul 5, 2017 at 14:02
  • In the end, I got our admin to use the entirely separate Zen hosting management website (at portal.zen.co.uk for any later readers) and add a new A record there. I never saw a "Simple DNS Zone Editor" option using my cPanel account; I don't know whether our admin could see it on his.
    – Ollyver
    Jul 10, 2017 at 14:00

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.