Accessing DirectAdmin, Proxying DA Through Apache/Nginx/LiteSpeed, Troubleshooting Login Issues, and Testing DA Connectivity

This article provides a comprehensive guide to accessing DirectAdmin, running the panel through Apache, Nginx, or LiteSpeed using reverse proxy, configuring proper client IP logging, troubleshooting login issues, and actively testing DirectAdmin connectivity using login keys and curl.

Proxying DA Through Apache/Nginx/LiteSpeedDA Connectivity

~3 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

  1. Create the domain cp.example.com under a normal DirectAdmin user.
  2. Enable SSL for the domain (Let’s Encrypt recommended).
  3. Go to: Admin Level → Custom HTTPD Configuration → cp.example.com
  4. 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:

See: DirectAdmin Feature 2194

---

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

Related Articles

Email Client Configuration & Dovecot Quota/Monitoring Guide for DirectAdmin Users

This guide explains how to configure popular email clients (iPhone Mail, Thunderbird, Gmail POP/SMTP), enable Dovecot LMTP quota warnings, and check the last login time for all email accounts on a DirectAdmin server. It includes step by step instructions, recommended IMAP/SMTP settings, and useful administrative scripts.

Continue

Troubleshooting Dovecot in DirectAdmin – Fixing IMAP Errors, Authentication Issues, and SSL Certificate Checks

Dovecot is the IMAP/POP3 server used by DirectAdmin. Sometimes users encounter errors such as “Connection dropped by IMAP server” or “unknown user” during authentication. This guide explains how to fix corrupted Dovecot indexes, understand authentication logs, hide unnecessary warnings, and manually inspect SSL certificates on IMAP ports 143 and 993.

Continue

DNS Troubleshooting in DirectAdmin – When named is Running but Domains Do Not Resolve

Sometimes the named (BIND) service runs normally, yet DNS queries fail or domains do not resolve from outside. This guide provides a complete troubleshooting workflow for checking named listeners, firewall rules, named.conf configuration, DNS propagation issues, subdomain problems, resolv.conf errors, and common Apache/Nginx misconfigurations.

Continue

Managing DNS Records in DirectAdmin – Complete Practical Guide for Administrators

DirectAdmin provides a powerful DNS management system that allows administrators to control TTL values, create SRV records, enable DNSSEC, manage subdomain delegation, automate TLSA records, and perform mass DNS updates. This guide explains all essential DNS operations in DirectAdmin with real-world examples and best practices.

Continue

DNS and Nameservers in DirectAdmin – Complete, Practical, and Professional Guide

DNS is the backbone of the internet, responsible for translating domain names into IP addresses. DirectAdmin allows you to create private nameservers (ns1/ns2), manage DNS zones, configure DNS clustering, use external DNS, and troubleshoot common issues. This guide provides a complete, clear, and practical explanation of DNS concepts and their implementation in DirectAdmin.

Continue

CustomBuild in DirectAdmin – Complete Guide to Installation, Updates, Configuration, and Advanced Customization

CustomBuild is DirectAdmin’s primary software management system. It installs, updates, configures, and rebuilds essential services such as Apache, Nginx, PHP, MariaDB/MySQL, Exim, Dovecot, FTP servers, and more. Because most components are compiled from source, CustomBuild offers exceptional flexibility, fast access to new versions, and optimized performance.

Continue