cPanelProxy Installation Howto


CPANEL and it’s interface (WHM and Webmail) by default use un-common port which is often blocked by local network policy. For example, CPANEL (non-https) uses port 2082, WHM uses port 2087, and webmail uses port 2095.

As stated on CPANEL.net FAQ, there’s no perfect solution for this at the moment, but there is a useable one by using cPanelProxy. Here’s how to install cPanelProxy on your server :Connect to your server via SSH and login to your normal user account (for cPanel, this account needs to be a member of the wheel group), then ‘su -‘ to root. At the prompt, type the following commands:

cd /usr/local/src
wget http://cpanelproxy.net/cPanelProxy.zip
mkdir cpanelproxy
cd cpanelproxy
unzip ../cPanelProxy.zip
cd ..
chown nobody.nobody cpanelproxy -R
chmod 755 cpanelproxy -R
mv cpanelproxy /usr/local/share

You have just downloaded the script and installed it, with the correct file ownership and permissions, into the /usr/local/share folder. The next step is to make a few changes to the Apache (web server) configuration file. Continue at the command prompt by typing the following:

pico /usr/local/apache/conf/httpd.conf

You will now be in the ‘UW PICO’ file editor. Scroll right down to the bottom of the file, and add the following lines:

<VirtualHost x.x.x.x>
ServerName cpanel.*
ServerAlias cpanel.* whm.* webmail.*
DocumentRoot /usr/local/share/cpanelproxy
</VirtualHost>

Replace x.x.x.x with all the IP addresses that are configured on your server, each separated by a space – optionally, only enter the IP addresses that you want to make the cPanel Proxy script available on. Once done, press [CTRL-O] then [RETURN] to save your changes, then press [CTRL-X] to exit the editor and return to the command prompt.

To enable the changes, we just need to restart Apache with the following command:

service httpd restart

Enabling Existing Accounts

Before you will be able to access the proxy script, we need to make some changes to DNS. For existing domains, some manual steps are required, as a few CNAME records need to be added to each domains zone file. This can be done either through WHM, or via the command line.

If you want to do this via WHM, once logged in to WHM, click ‘Edit a DNS Zone’ from the ‘DNS Functions’ menu on the left, select the domain you wish to edit from the list, then click the ‘Edit’ button. Scroll the page to the point where it says ‘Add New Entries Below this Line’, and add the following two entries into the relevant boxes on the screen:

cpanel 14400 IN CNAME yourdomain.com.
webmail 14400 IN CNAME yourdomain.com.

Make your you substitute in the real name of the domain you are editing and making sure that it ends with a dot as above. If you also want to add in a link to WHM, you can also add the following entry:

whm 14400 IN CNAME yourdomain.com.

I personally prefer to only do this on reseller domains, and my main domain, as normal users have no need to access WHM. Once your done, click the ‘Save’ button to complete your changes.

If you want to do these changes via the command line, from your SSH session, type the following command to edit the zone file directly:

pico /var/named/yourdomain.com.db

Make sure you substitute in the real name of your domain into the command above. You will now be back in the ‘UW PICO’ file editor. Scroll to the end of the file, and add the following lines:

cpanel 14400 IN CNAME yourdomain.com.
webmail 14400 IN CNAME yourdomain.com.

Again, make sure you substitute in the real name of your domain, making sure that it ends with a dot as above. As mentioned previously, if you also want to add in a link to WHM, you can also add the following entry:

whm 14400 IN CNAME yourdomain.com.

Once done, press [CTRL-O] then [RETURN] to save your changes, then press [CTRL-X] to exit the editor and return to the command prompt. The final step is to force your DNS server to re-read its configuration files, so that your changes take effect. At the command line, type:

killall -HUP named

You should now be able to open your web browser to http://cpanel.yourdomain.com/ and be correctly prompted for your username and password.
Enabling New Accounts

The final part of this HOW-TO is to enable the proxy script for all new accounts automatically, which avoids having to make the manual changes above in the future. From your SSH session, type the following commands:

pico /var/cpanel/zonetemplates/standard

You will now be in the ‘UW PICO’ file editor. Scroll to the bottom of the file, and add the following lines:

cpanel IN CNAME %domain%.
webmail IN CNAME %domain%.

Press [CTRL-O] then [RETURN] to save your changes, then press [CTRL-X] to exit the editor and return to the command prompt. Next, type the following, at the command prompt:

pico /var/cpanel/zonetemplates/standardvirtualftp

Again, you will now be back in the ‘UW PICO’ file editor. Scroll to the bottom of the file, and again add the following lines:

cpanel IN CNAME %domain%.
webmail IN CNAME %domain%.

Press [CTRL-O] then [RETURN] to save your changes, then press [CTRL-X] to exit the editor and return to the command prompt. You have now edited the default DNS zone template files, which are used to create the zone files for new domains – this means new accounts will automatically have the correct entries to access the cPanel Proxy script on their domain. I’ve not included the WHM entry, since I believe this should be manually added to reseller domains only, since normal users have no need to access WHM.

Advertisements

About piyecarane

Bla bla bla about me
This entry was posted in CPANEL, Linux and tagged , , , . Bookmark the permalink.

One Response to cPanelProxy Installation Howto

  1. Pingback: cPanelProxy No Longer Needed? « Web Development | Networking | System Administration

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s