linuxxed

Registered
Dec 9, 2005
1
0
151
Peeps,

I used to use cpanelproxy successfully on port 443 to server whm, cpanel and webmail. However after the upgrade cpanelproxy refused to work with webmail properly. I started looking into mod_proxy, compiled using apxs and I configured httpd.conf like

ProxyRequests Off

RewriteEngine On
RewriteCond %{HTTP_HOST} ^webmail.myhost.com$ [NC]
RewriteRule ^/(.*)$ http://localhost:2095/$1 [P,L]
RewriteCond %{HTTP_HOST} ^cpanel.myhost.com$ [NC]
RewriteRule ^/(.*)$ http://localhost:2082/$1 [P,L]
RewriteCond %{HTTP_HOST} ^whm.myhost.com$ [NC]
RewriteRule ^/(.*)$ http://localhost:2086/$1 [P,L]


Now cpanel and whm work file with urls https://cpanel.myhost.com and https://whm.myhost.com

but webmail (esp squirrelmail) is erratic on https://webmail.myhost.com. It launches fine but then after I compose an email and send, it tries to go to localhost:2095. After some debugging on squirrelmail code I traced the error to a PHP function called header(). I don;t know why mod_rewrite is missing that rewrite ...

Any ideas?


Has anyone tried to use something to server cpanel, webmail and whm from 443 port?


TIA

linuxxed
 

Einstein

Registered
Aug 21, 2004
4
0
151
Intresting case ... anyone having a solution? I'm intrested too.

Can this possible be used? Will a proxy or rewrite rules make much overhead on the CPU?
 

cookiesunshinex

Well-Known Member
Jun 10, 2005
77
0
156
Hello,

I'm trying to do the same thing, but I want to hide the port name in the URL.
I've installed the mod_proxy module and have the following lines loaded higher up in the httpd.conf.

LoadModule proxy_module libexec/mod_proxy.so
AddModule mod_proxy.c


I added this to the virtual server section of the domain, I'm trying to port alias:

ProxyPreserveHost On
ProxyPass / http://123.123.123.123:3003/
ProxyPassReverse / http://123.123.123.123:3003/

When I have the 3 Proxy lines added to the virtual server, HTTP won't restart.
 
Last edited:

cookiesunshinex

Well-Known Member
Jun 10, 2005
77
0
156
mod_proxy, subdomain alias, and port alias working together

OK,

I figured it out. I got it working like this.

1. compiled mod_proxy.so
2. edited httpd.conf to add these two lines

LoadModule proxy_module libexec/mod_proxy.so
AddModule mod_proxy.c

Then in the virtual server section for the subdomains, It looks like this.

<VirtualHost 123.123.123.123>
ServerAlias www.forums.maindomain.com
ServerAlias forums.seconddomain.com
ServerAlias forums.thirddomain.com
ServerAdmin [email protected]
DocumentRoot /home/user/public_html/forums
BytesLog domlogs/forums.maindomain.com-bytes_log
ServerName forums.maindomain.com

<IfModule mod_userdir.c>
Userdir disabled
Userdir enabled user
</IfModule>

<IfModule mod_php4.c>
php_admin_value open_basedir "/home/user:/usr/lib/php:/usr/local/lib/php:/tmp"
</IfModule>
<IfModule mod_php5.c>
php_admin_value open_basedir "/home/user:/usr/lib/php:/usr/local/lib/php:/tmp"
</IfModule>

User iloveju
Group user
CustomLog /usr/local/apache/domlogs/forums.maindomain.com combined
ScriptAlias /cgi-bin/ /home/user/public_html/forums/cgi-bin/

ProxyRequests Off
RewriteEngine On
RewriteCond %{HTTP_HOST} ^forums.maindomain.com$ [NC]
RewriteRule ^/(.*)$ http://forums.maindomain.com:3003/$1 [P,L]
RewriteCond %{HTTP_HOST} ^forums.seconddomain.com$ [NC]
RewriteRule ^/(.*)$ http://forums.seconddomain.com:3003/$1 [P,L]
RewriteCond %{HTTP_HOST} ^forums.thirddomain.com$ [NC]
RewriteRule ^/(.*)$ http://forums.thirddomain.com:3003/$1 [P,L]
</VirtualHost>


The end result is that I have 2 DNS aliases of the main domain.
subdomain pointer of forums, which points to the /home/user/public_html/forums/ directory
This directory is proxied, so originally, you must add :3003 on the end of the URL to get to the forums.

Original: http://www.maindomain.com:3003/forums
Now: http://forums.maindomain.com

I hope my documentation helps someone...as this took me about 3 hours to figure out.