How to redirect a subdomain to specific port?

#1
I would like https://cpanel.mydomain.com to redirect to https://mydomain.com:7080 (for example).

On cpanel hosting these redirects are set up automatically for things like mail.mydomain.com, cpanel.mydomain.com, etc. I gather that's being achieved in the vhost config files (as opposed to using .htaccess rewrite rules).

Is there a way to achieve this on OpenLightSpeed?

I've asked a similar question on CyberPanel forums, as ideally I'd like to have a way to automate this (and I am using CyberPanel), such that each new website I create has the necessary config rules pulled in (perhaps from a vhost template?). But there's been no reply on that post, so for now I am just keen to know how I can do this manually from an OpenLiteSpeed angle, so that these sub-domains redirect to a specific port I require.

Thanks,

Jonathan
 
#3
Thanks for that link.

So I've managed to set this up for one domain, such that `cyber.mydomain.zzz` seamlessly pulls up the content from `my-ip:8090`.

Is there any way to do this such that `cyber.anydomain.zzz` will proxy content from port 8090 ?

Or will I have to set this up on every domain manually?

Regards,

Jonathan
 

Pong

Administrator
#4
You can setup only one external app on server level, then use it for all virtual host. On Virtual host, if you use context way, you will need to do that on every domain manually. If you have used rewrite rule way, you will need to place the rewrite rule to each virtual host doc root .htaccess and restart OLS . " REWRITERULE ^(.*)$ HTTP://VHOST-PROXY1/$1 [P] "
 
#5
You can setup only one external app on server level, then use it for all virtual host. On Virtual host, if you use context way, you will need to do that on every domain manually. If you have used rewrite rule way, you will need to place the rewrite rule to each virtual host doc root .htaccess and restart OLS . " REWRITERULE ^(.*)$ HTTP://VHOST-PROXY1/$1 [P] "
If I set up one external app on server, and if I use the Context method... Do I need to add a relevant subdomain to each web site? (e.g. Adding the sub-domain `cpanel.primarydomain.com` to the website on `primarydomain.com`)

With either the Context method or htaccess method, Is there a way to have `cpanel.primarydomain.com` pull up the port without me having to add that subdomain to every web site?
 
#7
Is there a way to do the proxy using a domain alias, rather than having to set up an new virtual host for each subdomain I wish to proxy?

For example, I want to proxy cyber.mydomain.com and litespeed.mydomain.com. Currently I am having to set up a new website (in Cyberpanel, which means a new virtual host is created in OLS) for each of these domains. This then creates hosting folders, etc. on the server for those domains. These are not necessary, as I am not hosting websites on them. I am just using them to proxy to the IP and port for the CP and OLS dashboards.

Also it's impractical and messy to have to set up a cyber.clientdomain.com vhost for every client owned website on my server, just to give users and easy way to access their control panel.

What I would rather is that I add each as an alias (via CyberP) to the mydomain.com website. Then I issue an SSL for each alias domain. Then set up the Context settings on the mydomain.com virtual host in OLS, and have that Context detect if which domain is used to access the host and proxy it accordingly. Is this possible?
 
Last edited:

Pong

Administrator
#8
Your question is again a cyberpanel question , not OLS question. you 'd better talk to cypber panel to see any automation on proxy. On OLS side, you will need to do manually, unless you can setup your own script and create any necessary configuration for each virtual host based on the KB I sent to you.
 
Last edited:
Top