By default, DirectAdmin runs on port 2222, which means users need to log in via a URL like:
http://server.example.com:2222/
The problem? Many firewalls block non-standard ports, making it inconvenient for clients. A cleaner solution is to let users access their control panel from any hosted domain using:
https://domain.com/cpanel
This guide explains how to configure /cpanel as a proxy frontend for DirectAdmin across all domains, whether you’re running Nginx, Apache, or LiteSpeed.
Step 1: Why /cpanel?
Most clients are used to cPanel-style login URLs. Instead of teaching them a new port, /cpanel makes things familiar and professional. Plus, it avoids firewall restrictions and gives you a clean, SSL-secured path.
Step 2: Configure Nginx (All Domains)
If your DirectAdmin server is using Nginx:
- Open the DirectAdmin Nginx template:
nano /usr/local/directadmin/data/templates/nginx_server.conf
- Inside the
server { ... }block, add:
location /cpanel {
proxy_pass http://127.0.0.1:2222/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_redirect off;
}
- Apply changes:
cd /usr/local/directadmin/custombuild
./build rewrite_confs
service nginx restart
✅ Now every domain will serve DirectAdmin at /cpanel.
Step 3: Configure Apache (All Domains)
For Apache-based DirectAdmin servers:
- Edit the Apache template:
nano /usr/local/directadmin/data/templates/custom/httpd.conf
- Add the following inside each
<VirtualHost>block:
ProxyRequests off
SSLProxyEngine on
<Location "/cpanel">
ProxyPass "https://127.0.0.1:2222/"
ProxyPassReverse "https://127.0.0.1:2222/"
</Location>
- Rebuild configs and restart Apache:
cd /usr/local/directadmin/custombuild
./build rewrite_confs
service httpd restart
✅ Now /cpanel works on all hosted domains.
Step 4: LiteSpeed / OpenLiteSpeed
Since LiteSpeed is Apache-compatible, you can reuse the same <Location "/cpanel"> directives in its vhost config. Restart LiteSpeed after making changes.
Best Practices & Notes
- Always use
127.0.0.1:2222for proxying — it avoids DNS resolution loops. - Exclude conflicting paths like
/roundcubeor/phpmyadminif needed. - You can still set up
cp.example.comas a dedicated login domain for branding, while keeping/cpanelas a fallback.
Final Result
With this setup:
https://domain1.com/cpanelhttps://domain2.com/cpanelhttps://domain3.com/cpanel
…all point to DirectAdmin securely — no more confusing ports!
Leave a Reply