Another article I wrote once.Hope you like it.
This is an interesting tutorial for web hosting companies who want to give their customers the ability to use cPanel even when the port it uses (2082) is blocked by a firewall. For this, we will be using the mod_proxy module, which gets shipped with Apache.
You may already be aware that this trick is possible using cPanel Proxy from www.cpanelproxy.net. But why use a PHP script to act as proxy when Apache already has a module designed to do this for you? I prefer the mod_proxy way, so let’s get started.
Locate the mod_proxy files where cPanel stores the Apache source:
Install mod_proxy using the axps tool:Code:cd /home/cpapachebuild/buildapache/apache_1.3.XX/ cd src/modules/proxy/
At this point you’ll have to choose a sub-domain to use for your cPanel proxy. For example if your hosting company is called foobar.com you could use cpanel.foobar.com. Use cPanel to add the sub-domain.Code:/usr/local/apache/bin/apxs -c -i *.c
Once the sub-domain has been successfully created via cPanel, edit the Apache configuration file:
Add the following lines to the configuration file to make sure mod_proxy gets loaded with Apache:Code:nano /usr/local/apache/conf/httpd.conf
Somewhere at the end of this file you’ll find the VirtualHost directive for your cpanel.foobar.com sub-domain. At the bottom of this VirtualHost directive, add the following lines:Code:LoadModule proxy_module libexec/mod_proxy.so AddModule mod_proxy.c
Finally, restart Apache:Code:ProxyRequests Off ProxyPass / http://127.0.0.1:2082/ ProxyPassReverse / http://127.0.0.1:2082/
You can now use http://cpanel.foobar.com as if you were connecting to cPanel on port 2082. This trick also works for WebHostManager (by using port 2086) and cPanel Webmail (by using port 2095).Code:service httpd restart
Known issues
Because you’re now using cPanel over Apache using mod_proxy, be aware that your mod_security rules will apply! So far I’ve only found one issue caused by a mod_security rule, which is when I tried to install certain scripts with Fantastico (such as Joomla). In my rules.conf file I found the following line:
Just remove that line from the configuration file (and restart Apache) to fix this problem. If you find any other mod_security problems when using this mod_proxy trick, please let me know and I’ll update my post.Code:SecFilterSelective THE_REQUEST “\.htpasswd”


LinkBack URL
About LinkBacks
Hope you like it.



Reply With Quote


