cPanel Proxy is a small PHP script which allows users to access cPanel, WHM and Web Mail on port 80 by acting like a proxy. Its very helpful for people who are behind firewall.
This tutorial guides you on ow to make a server-wide installation of cPanel Proxy so all accounts created on your server gets access to cPanel Proxy (can access cpanel on port 80)
Installing
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:
ServerName cpanel.*
ServerAlias cpanel.* whm.* webmail.*
DocumentRoot /usr/local/share/cpanelproxy
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.
PS: This How-To was originally published by Unofficial-Support(.com) (http://unofficial-support.com/node/view/50). As the site doest exit any more i have copied their tutorial from an old archive. All credits go to the original author (simon).
Tags: cPanel, How-To, Linux, Tech, Technology, Tips and Tricks, Tutorials, Unix
Categories: Tech, Tips and Tricks, Tutorials