» Knowledgebase - If its not here, Just ask.

Virtual Dedicated Servers » DirectAdmin

ID #1114

Running DirectAdmin through port 80 (blocked access)

Several people are unable to connect to DirectAdmin on port 2222 due to firewalls or proxies. It is possible to setup apache to allow DirectAdmin to run through apache using its proxy options.

In this example, we'll setup DirectAdmin to run through cp.domain.com for any domain on your machine. This can be tweaked however you wish.
**Note** if you're running custombuild, you must recompile apache by adding "--enable-proxy" \ to the configure/ap2/configure.apache file, and recompiling apache and php.
Also, for apache 2, the template is virtual_host2.conf, not virtual_host.conf.

1) Duplicate the VirtualHost template:

cd /usr/local/directadmin/data/templates
cp virtual_host.conf custom
cd custom

You can copy all of the virtual_host*.conf files if you wish to access it with any method (https etc).

2) Make the changes to the template. Edit the newly copied virtual_host.conf files (repeat this for the other VirtualHost files if you copied them). Add

<VirtualHost |IP|:80>
   ServerName cp.|DOMAIN|
   ProxyRequests Off
   ProxyPass / http://localhost:2222/
   ProxyPassReverse / http://localhost:2222/
</VirtualHost>

To the end of the virtual_host.conf file, just after the virtualhost that is already there. (Yes, there will be 2 in one file). Repeat this for the other files if you copied them (but use 443 for the ssl version, with the ssl related options). If this is apache 2, you may need to add "SSLProxyEngine on" into the virtualhost if you are using DA with SSL.

3) Enable mod_proxy in your /etc/httpd/conf/httpd.conf file. Edit that file and uncomment the followig lines (remove the # character)

LoadModule proxy_module modules/libproxy.so

AddModule mod_proxy.c



4) rewrite the user httpd.conf files:

echo "action=rewrite&value=httpd" >> /usr/local/directadmin/data/task.queue



Wait a few minutes for the rewrite to happen and for apache to restart itself.

5) You'll also need to add a cp A record for all your domains so that cp.domain.com actually resolves. To get DA to add one by default for new zones:

cd /usr/local/directadmin/data/templates
cp dns_a.conf custom
cd custom
echo "cp=|IP|" >> dns_a.conf



6) Note that the Proxy requets will use a "Host" apache header value of "localhost", which causes the webmail, squirrelmail and phpMyAdmin links to be (eg): http://localhost/webmail. You can change that by adding:

|?HOSTNAME=yourhost.com|

at the very top of /usr/local/directadmin/data/skins/enhanced/header.html so that it overwrite the previous setting of "localhost". Another method would be to use "ProxyPass / http://yourhost.com:2222/" instead of "ProxyPass / http://localhost:2222/".
Categories for this entry

Tags: -

Related entries:

Last update: 2008-10-10 09:24
Author: Support TEAM
Revision: 1.0

Digg it! Print this record Send to a friend Show this as PDF file
Propose a translation for Propose a translation for
Please rate this entry:

Average rating: 0 out of 5 (0 Votes )

completely useless 1 2 3 4 5 most valuable

You cannot comment on this entry