How to set up AutoSSL on different port

TechBill

Well-Known Member
Aug 7, 2011
50
4
58
I am running a web script that is on a different web port. How do I get AutoSSL to install certification for web sites that are running on different port other than standard port 80.

Example : https://example.com:10000
 
Last edited by a moderator:

cPanelLauren

Product Owner II
Staff member
Nov 14, 2017
13,266
1,300
363
Houston
Hi @TechBill


The issue isn't the installation of the certificate it's the VirtualHost - you'd need to create an SSL VirtualHost with the certificate details or modify the template. The documentation for this can be found here: Custom Templates - EasyApache - cPanel Documentation

This would be a customization that wouldn't be supported by cPanel though and could potentially cause issues if done incorrectly.
 

TechBill

Well-Known Member
Aug 7, 2011
50
4
58
Hi @TechBill


The issue isn't the installation of the certificate it's the VirtualHost - you'd need to create an SSL VirtualHost with the certificate details or modify the template. The documentation for this can be found here: Custom Templates - EasyApache - cPanel Documentation

This would be a customization that wouldn't be supported by cPanel though and could potentially cause issues if done incorrectly.
As I read the documentation and if i understand this correctly,

I would need to make a local copy of the ssl vhost template and change this line

<Proxymatch ^https?://127\.0\.0\.1:(2082|2083|2077|2078|2079|2080|2086|2087|2095|2096)/>
to
<Proxymatch ^https?://127\.0\.0\.1:(2082|2083|2077|2078|2079|2080|2086|2087|2095|2096|10000)/>
by adding port 10000?

and save it in the userdata directory?
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,258
463
Hello @TechBill,

The updated instructions for EasyApache 4 are available on the following link:

Custom Templates - EasyApache 4 - cPanel Documentation

However, can you confirm if all domains are using the custom port? Or, do you host a mixture of domains with some using the custom port and others using the default port?

If all domains are using the custom port, you can simply browse to WHM >> Tweak Settings and modify the port next to the following option under the System tab:

Apache SSL port

Otherwise, you'd need to consider modifying the Apache template for individual virtual hosts per the instructions in the above document.

I would need to make a local copy of the ssl vhost template and change this line

<Proxymatch ^https?://127\.0\.0\.1:(2082|2083|2077|2078|2079|2080|2086|2087|2095|2096)/>
to
<Proxymatch ^https?://127\.0\.0\.1:(2082|2083|2077|2078|2079|2080|2086|2087|2095|2096|10000)/>
by adding port 10000?
No, those are entries for the Service Subdomains feature (e.g. cpanel.domain.tld). Here's a link to a thread you may want to use as a point of reference if you are open to using ProxyPass entries to redirect requests from the custom port to the standard port on an individual domain's SSL virtual host:

Jira mod_proxy subdomain

Thank you.
 

Sylvester91

Registered
Nov 30, 2020
2
0
1
France
cPanel Access Level
Root Administrator
I come to this topic to ask the same question or almost. My domain after expiration of the ssl certificate and renewal with AutoSSL is not accessible via port 8080 in ssl. When I do domain.com:8080/resources I get a message <<expired certificate>> while my certificate is valid.

I tried to follow the documentation that talks about modifying the vhost with *.local but at the end when I put this script below in a file to run it I get an error beacuase of ")"

Bash:
perl -MYAML::Syck -e \
'my $hr = YAML::Syck::LoadFile($ARGV[0]);$hr->{$ARGV[1]} = $ARGV[2];YAML::Syck::DumpFile($ARGV[0],$hr);' \
/var/cpanel/userdata/username/domainname custom_vhost_template_ap2 path/to/template

So I would like to know how I can make my site accessible on port 8080 or other with ssl.

The port is already open on the firewall.
I am under centos 7 with cpanel