Access cPanel through Proxy when behind a firewall

cpanelcPanel has become a standard for turning standalone servers into automated hosting platforms. Tasks are replaced by web interfaces and API-based calls. cPanel is designed with multiple levels of administration and provide multiple levels provide security, ease of use, and flexibility for everyone from the server administrator to the email account user.

cPanel powers web hosting companies and organizations that have a need to automate and offer competitive hosting services. cPanel can generally be run on port 2082 and webmail services generally provided through cPanel at port 2095. Many organizations, educational and learning facilities, and places of business have blocked these ports from use. However, there is a work-a-round through a proxy that does work.JAP4CPANEL (or JAP) is a proxy that allows you to access cPanel, WebHostManager, and webmail through port 80. It is compatible with the latest version of cPanel, WebHostManager, and webmail, and it uses the cURL library to optimize performance.

JAP is available for PHP4 and PHP5 but requires the cURL library (which is installed on most web servers).

The installation instructions are provided in the README.txt from the JAP4CPANEL-1.1.1 download. This is my interpretation of those instructions.

INSTALL
Create Subdomains

  • Use a workstation that can access cPanel.
  • Open cPanel, under Domains, select Subdomains
    cpanel2
    cpanel3
  • Create a subdomain for cPanel. Type cpanel in the Subdomain box and press the create button. This will create cpanel.yourdomain.com.
  • Create a subdomain for webhostmanager. Type whm in the Subdomain box and press the create button. This will create whm.yourdomain.com.
  • Create a subdomain for webmail. Type webmail in the Subdomain box and press the create button. This will create webmail.yourdomain.com.

Install the JAP4CPANEL proxy

  • Unzip JAP4CPANEL-x.y.z.zip and upload TMP, .htaccess, jap.index.php, jap.php4.php and jap.php5.php to each directory associated with each new subdomain (for example: /public_html/cpanel/, /public_html/whm, /public_html/webmail, /wwwroot/webmail, /www/webmail, etc.)
  • Open and edit jap.index.php found in each of the three directories. Change the following line for each directory accordingly:
    For cPanel: Change the domain and port “$jap = new Jap(‘http://j4php.org:2082′);” to “$jap = new Jap(‘http://yourdomain.com:2082′);”
    For whm: Change the domain and port “$jap = new Jap(‘http://j4php.org:2086′);” to “$jap = new Jap(‘http://yourdomain.com:2086′);”
    For webmail: Change the domain and port “$jap = new Jap(‘http://j4php.org:2095′);” to “$jap = new Jap(‘http://yourdomain.com:2095′);”
  • Save jap.index.php
  • Change permissions (chmod) of TMP for each directory to 777 (for example: /public_html/cpanel/TMP/, /public_html/whm/TMP/, /public_html/webmail/TMP/,)

Accessibility

  • To access cPanel, open http://cpanel.yourdomain.com
  • To access whm, open http://whm.yourdomain.com
  • To access webmail, open http://webmail.yourdomain.com