0

I have a VPS that has CPanel installed on.

I have created a subdomain mail.mysite.com but whenever we visit the site using that, we get a page that says index of and shows couple of files.

However, when we use www.mail.mysite.com it works totally fine and we are redirected to the correct place.

Here is my current configuration in CPanel

enter image description here

Any insights?

6
  • Did you point the domain name servers to those hosted on your cPanel server? Did you setup the redirect from cPanel's Subdomains or from the WHM interface Setup/Edit Domain Forwarding? I believe the cPanel interface requires you to separately setup forwarding for the www and non-www subdomain.
    – Cas
    Commented Dec 1, 2016 at 7:53
  • @cascer1 check my edited answer where I have added a screenshot of my current setting
    – tony9099
    Commented Dec 1, 2016 at 9:24
  • By default the mail subdomain is used to configure email clients for cpanel. I believe cpanel does automatically add a webmail subdomain that allows users to login. I'm pretty sure version 60 allows per-user sll certificates for the webmail subdomains too. Do all other redirects work fine?
    – Cas
    Commented Dec 1, 2016 at 10:12
  • some do and some do not. some subdomains I am forced to use www infront to get a proper redirection.
    – tony9099
    Commented Dec 1, 2016 at 12:10
  • For the subdomains that you are forced to use www. They don't happen to be mail, webmail, whm or cpanel, do they?
    – Cas
    Commented Dec 1, 2016 at 13:01

1 Answer 1

0

I assume you're making these subdomain redirections because you want to enforce SSL connections.

By default, the mail, webmail, whm and cpanel subdomains are reserved by cPanel. These subdomains are used to present visitors with a login screen for the related service. The mail subdomain points to the main server IP by default, this one is used to configure email clients.

cPanel also allows you to either:

  1. Disable these proxy subdomains (as they're called) entirely,
  2. Disable creation of these subdomains in DNS, or
  3. Allow users to override these proxy subdomains with their own settings.

If you use these subdomains to simply redirect users to the correct login page for the service, make sure to enable proxy subdomains and proxy subdomain creation in WHM > Server Configuration > Tweak Settings

I can see that you're trying to redirect users to the SSL-secured versions of the login pages, you can try any of the following solutions:

  1. Don't touch the subdomains from cPanel. Users should automatically be presented with a login page. If you enforce SSL here, users will be presented with the SSL certificate installed on that service.
  2. Have users visit <domain>/whm, <domain>/cpanel or <domain>/webmail. cPanel will offer them the choice to use a secure or insecure connection. This behavior can be tweaked in the Redirection tab of Tweak Settings. If the domain has a valid SSL certificate, this can be offered to them when visiting this page. (I believe this was introduced in cPanel version 60)
  3. Have users visit <hostname>:2083 for cPanel, <hostname>:2096 for webmail or <hostname>:2087 for WHM. These are the secure versions of all services. Users will be presented with an SSL certificate for the server hostname. Subtract 1 from a port number to use the insecure version instead.

cPanel recently changed how service SSL certificates are managed. Have a look at the documentation for more info. It boils down to that you can install your own certificate or they generate and sign one for you if you don't have one.

As far as I know, you can't install a different certificate for the service ports on other domains. There's just one global SSL certificate for all services across all domains on the server. I do believe that this is a feature they plan on implementing in the future.

TL;DR: You probably shouldn't overwrite the proxy subdomains (mail., cpanel., whm., webdisk., calendar.) in cPanel, since cPanel already handles redirects for them. If you want a secure connection, you can visit <domain>/cpanel (or /whm or /webmail) to either let users choose where to go, or automatically redirect them to <domain>:2083, :2087 or :2096. This can be tweaked in the Redirection tab in Tweak Settings

Proxy subdomains currently only present the server hostname certificate, so beware of certificate errors when visiting them from other domains.

EDIT: found the feature request

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .