~4 min read • Updated Mar 1, 2026
1. Accessing the DirectAdmin Panel
By default, DirectAdmin listens on port 2222. You can access it using either the server IP or hostname:
http://12.34.56.78:2222/
http://hostname.yourdomain.com:2222/
If port 2222 is blocked by a firewall or proxy, you can run DirectAdmin through Apache, LiteSpeed, or Nginx using reverse proxy.
---2. Running DirectAdmin Through Apache (Port 80)
Some networks block port 2222. To bypass this, you can proxy DirectAdmin through Apache using a subdomain such as cp.example.com.
2.1 Steps
- Create the domain cp.example.com under a normal DirectAdmin user.
- Enable SSL for the domain (Let’s Encrypt recommended).
- Go to: Admin Level → Custom HTTPD Configuration → cp.example.com
- Insert the following into the |CUSTOM| section:
|*if SSL_TEMPLATE="1"|
|?HAVE_PHP1_FCGI=0|
|?HAVE_PHP2_FCGI=0|
|?HAVE_PHP1_FPM=0|
|?HAVE_PHP2_FPM=0|
|?CLI=0|
|?HAVE_PHP1_CLI=0|
|?HAVE_PHP2_CLI=0|
|?SUPHP=0|
|?HAVE_PHP1_SUPHP=0|
|?HAVE_PHP2_SUPHP=0|
ProxyRequests off
SSLProxyEngine on
ProxyPass /phpmyadmin !
ProxyPass /phpMyAdmin !
ProxyPass /webmail !
ProxyPass /roundcube !
ProxyPass / "https://server.example.com:2222/"
ProxyPassReverse / "https://server.example.com:2222/"
|*else|
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !^/.well-known
RewriteRule (.*) Error! Hyperlink reference not valid. [R=301,L]
|*endif|
2.2 Enable Proper Client IP Logging
cd /usr/local/directadmin
./directadmin set x_forwarded_from_ip "12.34.56.78"
service directadmin restart
This ensures DirectAdmin logs the real client IP instead of the proxy IP.
---3. Running DirectAdmin Through LiteSpeed
LiteSpeed requires a different configuration because it handles proxying differently.
3.1 Insert the following into the |CUSTOM| section:
|*if SSL_TEMPLATE="1"|
|?HAVE_PHP1_FCGI=0|
|?HAVE_PHP2_FCGI=0|
|?HAVE_PHP1_FPM=0|
|?HAVE_PHP2_FPM=0|
|?CLI=0|
|?HAVE_PHP1_CLI=0|
|?HAVE_PHP2_CLI=0|
|?SUPHP=0|
|?HAVE_PHP1_SUPHP=0|
|?HAVE_PHP2_SUPHP=0|
RewriteEngine On
RewriteRule ^(.*)$ https://cp.|DOMAIN|:2222/$1 [P,L]
|*else|
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !^/.well-known
RewriteRule (.*) Error! Hyperlink reference not valid. [R=301,L]
|*endif|
3.2 LiteSpeed Proxy Restrictions
If you see this error:
Proxy target is not defined on external application list
You must add the proxy target manually in:
LiteSpeed Admin → Configuration → Server → External App → Add
Then perform a graceful reload.
---4. Running DirectAdmin Through Nginx
Edit:
/etc/nginx/nginx-includes.conf
Add:
server {
listen "12.34.56.78:80";
server_name "cp.example.com";
include /etc/nginx/webapps.conf;
location / {
proxy_pass "http://server.example.com: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 "http://cp.example.com:2222/" "http://cp.example.com/";
}
}
Restart Nginx:
service nginx restart
---
5. Troubleshooting Login Issues
If login fails, run DirectAdmin in debug mode (level 2000). Example error:
Referer port (443) does not match DA's (2222)
Fix by disabling referer port checks:
---6. Actively Testing DirectAdmin Connectivity
You can test whether DirectAdmin is responding and whether login credentials work by using a login key and curl.
6.1 Create a Login Key
In DirectAdmin:
- Key Name: curltest
- Commands Allowed: CMD_API_LOGIN_TEST
- Allowed IPs: 127.0.0.1
6.2 Create Test Script
File:
/home/username/da_test.sh
Content:
#!/bin/sh
DEBUG=0
USER="username"
PASSWORD="loginkey"
CONFIG=curl_config.txt
echo -n '' > ${CONFIG}
echo "user = \"${USER}:${PASSWORD}\"" >> ${CONFIG}
RUN="curl --config ${CONFIG} --silent --show-error http://127.0.0.1:2222/CMD_API_LOGIN_TEST"
RESULT=`eval $RUN 2>&1`
RET=$?
COUNT=`echo "$RESULT" | grep -c 'error=0'`
if [ "${COUNT}" -gt 0 ]; then
exit 0;
else
exit ${RET}
fi
Make executable:
chmod 700 /home/username/da_test.sh
6.3 Run Test
/home/username/da_test.sh; echo $?
If output is 0, DirectAdmin is working correctly.
6.4 Automate with Cron
Create a cronjob:
/home/username/da_test.sh
Enable email notifications to receive alerts if DirectAdmin stops responding.
Written & researched by Dr. Shahin Siami