point subdomain to local ip
Hi, im trying to point subdomain to use another vps with a private ip in the same network with WHM, DNS done with cloudflare because vps inside is on edge network and only allow 80 and 443,
i adding this to Apache's pre-main include directive in WHM,
<VirtualHost 10.10.53.2:80>
ServerName subdomain.example.com
ServerAlias www.subdomain.example.com
ProxyRequests Off
ProxyPreserveHost On
ProxyPass / http://192.168.226.10:80/
ProxyPassReverse / http://192.168.226.10:80/
</VirtualHost>
and it works for http, but i've no idea how to do https, external wildcard SSL certificate already installed on the WHM, tried to add ssl host with WHM but its redirect to cpanel defaultwebpage.cgi
is it possible for https ?
Thanks
-
Hey there! While I can't say for sure, couldn't you just add another entry for the secure 443 vhost?
0 -
tried adding this to apache's pre-main together with the http one but it brings every domain/sub hosted with WHM goes down and unreacheable
<VirtualHost 10.10.53.2:443>
ServerName subdomain.example.com
ServerAlias www.subdomain.example.comProxyRequests Off
ProxyPreserveHost On
ProxyPass / https://192.168.226.10:443/
ProxyPassReverse / https://192.168.226.10:443/</VirtualHost>
0 -
Since the entry is in the pre-main file, it could be catching all private traffic somehow, so maybe that isn't the best way to handle that.
Have you created a cPanel account for this domain so there is a normal vhost in place? If so, you may be able to customize that particular vhost with an include as outlined here:
https://docs.cpanel.net/ea4/apache/modify-apache-virtual-hosts-with-include-files/
but I'm just not sure cPanel is designed to handle this type of configuration without it causing problems for other sites.
0 -
i think i found the solution and it works
<VirtualHost 10.90.53.2:443>
ServerName subdomain.example.com
SSLEngine on
SSLProxyEngine On
SSLCertificateFile /var/cpanel/ssl/cpanel/mycpanel.pem
SSLCertificateKeyFile /var/cpanel/ssl/cpanel/mycpanel.pem
RequestHeader set X-HTTPS 1
ProxyPreserveHost On
ProxyPass / http://192.168.226.10/
ProxyPassReverse / http://192.168.226.10/</VirtualHost>
should i put it on post vhost include editor?
0 -
You're welcome to try, but you're in untested territory so you'll have to test it and see if it works how you expect.
0
Please sign in to leave a comment.
Comments
5 comments