I have cPanel & WHM v130.0.14 STANDARD running in an EC2 instance. Trying to setup a reverse proxy with Apache2 by setting a CNAME some.example.com (not the real one) to forward the request to api.demo.com — the catch is that I need to use some.example.com for input and output. To demonstrate, a sample vhost configuration for Apache would be:
<VirtualHost 192.168.0.10:443>
ServerName some.example.com
SSLEngine on
SSLCertificateFile /etc/letsencrypt/archive/example.com/fullchain7.pem
SSLCertificateKeyFile /etc/letsencrypt/archive/example.com/privkey7.pem
SSLProxyCheckPeerCN off
SSLProxyCheckPeerName off
SSLProxyEngine On
ProxyPreserveHost On
ProxyPass / https://some.example.com/
ProxyPassReverse / https://some.example.com/
</VirtualHost>
For this to work I would need to either set a static IP for some.example.com into /etc/hosts or, what I'm actually trying to achieve, set a CNAME in named (PDNS handled) to make some.example.com translate to whatever address api.demo.com resolves to.
Tried numerous solutions between setting a local zone for demo.com or creating forwarders, but I can't get anything to work; that is, it just resolves to the default record's address published by Cloudflare. As far as I've seen this should work, so for now I just reverted to the simple CNAME approach:
- /etc/resolv.conf
nameserver 127.0.0.1
nameserver 1.1.1.1
nameserver 8.8.8.8
- /etc/named.conf
view "internal" {
match-clients { localnets; };
match-destinations { localnets; };
recursion yes;
zone "." IN {
type hint;
file "/var/named/named.ca";
};
zone "192-168-0-10.cprapid.com" {
type master;
file "/var/named/192-168-0-10.cprapid.com.db";
};
zone "example.com" {
type master;
file "/var/named/example.com.db";
};
};
view "external" {
recursion no;
zone "." IN {
type hint;
file "/var/named/named.ca";
};
zone "192-168-0-10.cprapid.com" {
type master;
file "/var/named/192-168-0-10.cprapid.com.db";
};
zone "example.com" {
type master;
file "/var/named/example.com.db";
- /var/named/example.com.db
; cPanel first:124.0.21 (update_time):1760587729 Cpanel::ZoneFile::VERSION:1.3 hostname:192-168-0-10.cprapid.com latest:130.0.14
; Zone file for example.com
$TTL 14400
example.com. 86400 IN SOA ns1.192-168-0-10.cprapid.com. root.192-168-0-10.cprapid.com. 2025101605 3600 1800 1209600 86400
example.com. 86400 IN NS ns1.192-168-0-10.cprapid.com.
example.com. 86400 IN NS ns2.192-168-0-10.cprapid.com.
ns1 14400 IN A 192.168.0.254
ns2 14400 IN A 192.168.0.254
example.com. 14400 IN A 192.168.0.10
some 14400 IN CNAME api.demo.com.
Am I missing something?