Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Apache mod_proxy with cpanel

Discussion in 'EasyApache' started by linuxxed, Dec 9, 2005.

  1. linuxxed

    linuxxed Registered

    Joined:
    Dec 9, 2005
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    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
     
  2. Einstein

    Einstein Registered

    Joined:
    Aug 21, 2004
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    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?
     
  3. cookiesunshinex

    cookiesunshinex Well-Known Member

    Joined:
    Jun 10, 2005
    Messages:
    77
    Likes Received:
    0
    Trophy Points:
    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.
     
    #3 cookiesunshinex, Oct 3, 2006
    Last edited: Oct 3, 2006
  4. cookiesunshinex

    cookiesunshinex Well-Known Member

    Joined:
    Jun 10, 2005
    Messages:
    77
    Likes Received:
    0
    Trophy Points:
    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 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.
     
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice