Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Dec 2005
    Posts
    1

    Default Apache mod_proxy with cpanel

    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

  2. #2
    Registered User
    Join Date
    Aug 2004
    Posts
    4

    Default

    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?

  3. #3
    Member
    Join Date
    Jun 2005
    Posts
    77

    Default

    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 by cookiesunshinex; 10-03-2006 at 06:02 PM.

  4. #4
    Member
    Join Date
    Jun 2005
    Posts
    77

    Default 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 webmaster@forums.maindomain.com
    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.

Similar Threads & Tags
Similar threads

  1. mod_proxy in Apache
    By sergiolobo in forum cPanel and WHM Discussions
    Replies: 15
    Last Post: 08-25-2006, 01:13 PM
  2. How to enable Apache module mod_proxy
    By okanari in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 02-06-2006, 01:52 PM
  3. mod_proxy on cpanel's apache is it installed?
    By albatroz in forum cPanel and WHM Discussions
    Replies: 4
    Last Post: 09-07-2004, 11:24 PM
  4. mod_proxy under apache
    By diederik in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 07-25-2003, 11:38 AM
  5. mod_proxy is not working after apache upgrade
    By rms in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 07-20-2003, 01:07 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube