Author Topic: reverse proxy on cwp hostname  (Read 2912 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
reverse proxy on cwp hostname
« on: March 14, 2022, 09:08:56 PM »
Hello
I would like to thank cwp for this panel. I recently adopted the CWP panel. I find it very impressive. My problem lies with the access url to the cwp panel. Usually the panel is accessed on this url : https://mydomain:2031. I very sincerely want to have access to my panel just through a domain like https://subdomains.com without going through the port. I have already used a reverse proxy from another aapanel server which did not work. But I made the reverse proxy from aapanel to my tomcat server running on my port 8080 on my cwp panel. The result was what I wanted. I had access to the tomcat service on another domain without the port. I did the same thing to the port of my panel but without success.

Please help me if you have ever had to deal with this problem.

thanks in advance

Offline
****
Re: reverse proxy on cwp hostname
« Reply #1 on: March 15, 2022, 12:59:53 AM »
cpanel.(hostname) should work so long as your have an A record set up in the dns for it
Google Hangouts:  rcschaff82@gmail.com

Offline
*
Re: reverse proxy on cwp hostname
« Reply #2 on: March 15, 2022, 08:08:24 AM »
yes absolutely you are right. But that's not the problem I described. thanks anyway for your help

Offline
****
Re: reverse proxy on cwp hostname
« Reply #3 on: March 15, 2022, 01:47:55 PM »
take a look at the following files for how to setup the proxy.

Apache:
/usr/local/apache/conf.d/hostname.conf and hostname-ssl.conf

Nginx:
/etc/nginx/conf.d/hostname.conf and hostname-ssl.conf

Please remember that if you edit these files directly, there is always the possibility that they can be overwritten during an upgrade.
Google Hangouts:  rcschaff82@gmail.com

Offline
*
Re: reverse proxy on cwp hostname
« Reply #4 on: October 23, 2022, 01:55:39 PM »
I also trying to do this access the panel without port number,
example
hostname.example.com:2031 >> change to hostname.example.com/admin
hostname.example.com:2083 >> change to hostname.example.com/user

or
hostname.example.com:2031 >> change to cwpadmin.example.com
hostname.example.com:2083 >> change to cwpuser.example.com

but looks like CWP has 301 permanent redirect in the config file/usr/local/cwpsrv/conf/cwpsrv.conf
Maybe we could tries
1. remove the permanent redirect in /usr/local/cwpsrv/conf/cwpsrv.conf
2. use proxy "proxy_pass" in /etc/nginx/conf.d/hostname.conf and hostname-ssl.conf


Like this:

Code: [Select]
<VirtualHost *:8181>
    ServerAdmin hostmaster@example.com
    ProxyRequests off
    DocumentRoot /home/DOMAIN_DIR
    ProxyPreserveHost On

    ServerName panel.my_domain.com

    ServerAlias panel.my_domain.com

    <Location />
        ProxyPass http://panel.my_domain.com:2030/
        ProxyPassReverse http://panel.my_domain.com:2030/
        Order allow,deny
        Allow from all
    </Location>
</VirtualHost>

?


Related/Similar Topics
https://forum.centos-webpanel.com/index.php?topic=5194.0
https://forum.centos-webpanel.com/index.php?topic=6182.0
http://forum.centos-webpanel.com/how-to/how-to-change-cwpsrvd-listen-port-(cwp)/
« Last Edit: October 23, 2022, 02:35:46 PM by weasam »

Offline
*
Re: reverse proxy on cwp hostname
« Reply #5 on: October 23, 2022, 02:53:51 PM »
My Solution is create domains
for admin
cwpadmin.mydomain.com
for user
cwpuser.mydomain.com

Then do the reverse proxy
[CWP] WebServers Settings >> WebServers Domain Conf >> Select User&Domain: cwpadmin.mydomain.com
>>
[Nginx >Proxy > custom port]
Custom port: 2031
IP: hostname.mydomain.com  ##this is the host domain need to port number to visit the admin panel.

Not ready yet. we still need to change something in vhost for domain change proxy_pass url from http to https since we need to visit with SSL

[CWP] WebServers Settings >> WebServers Conf Edictor >>
/etc/nginx/conf.d/vhosts/cwpadmin.mydomain.com.conf
/etc/nginx/conf.d/vhosts/cwpadmin.mydomain.com.ssl.conf

Offline
***
Re: reverse proxy on cwp hostname
« Reply #6 on: October 24, 2022, 01:09:46 AM »
My Solution is create domains
for admin
cwpadmin.mydomain.com
for user
cwpuser.mydomain.com

Then do the reverse proxy
[CWP] WebServers Settings >> WebServers Domain Conf >> Select User&Domain: cwpadmin.mydomain.com
>>
[Nginx >Proxy > custom port]
Custom port: 2031
IP: hostname.mydomain.com  ##this is the host domain need to port number to visit the admin panel.

Not ready yet. we still need to change something in vhost for domain change proxy_pass url from http to https since we need to visit with SSL

[CWP] WebServers Settings >> WebServers Conf Edictor >>
/etc/nginx/conf.d/vhosts/cwpadmin.mydomain.com.conf
/etc/nginx/conf.d/vhosts/cwpadmin.mydomain.com.ssl.conf


why you guys always love the complicated ways ?


add subdomain: admin.mydomain.com
add subdomain: user.mydomain.com
add index.php
put header auto redirect 0 second or 1 second and put some "beauty of html5"
admin: forward to root cwp
user: forwart to user cwp


same methode can be applied to
mydomain.com/admin
mydomain.com/user


even cpanel use that .. and display the port... except you have 1 server for cwp only... you can modified the 80 443 to cwp port ... it will display no port