Shakiba Moshiri
  • Shakiba Moshiri (شکیبا مشیری)
  • opt
    • high traffic site optimization
      • infrastructure check
      • infrastructure test
  • tools
    • Cryptsetup
      • Container encryption using cryptsetup
    • curly
      • ftp
      • ssl
      • http
      • dns
      • ip
      • email
    • SSH
      • ssh password-less login
        • Untitled
    • volumes and FS
      • installing Gluster fs on Ubuntu 18.04 server
      • Accessing Gluster FS from the client machine
  • CDN
    • How does a CDN work
  • Server Panel
  • DirectAdmin
    • DirectAdmin through a reverse proxy
  • Web Server
    • Nginx
      • Live Steaming with Nginx and FFMPEG
  • Security
  • Container
    • Docker Networking 101
      • why docker networking is important?
      • type of networking in docker
    • Docker
      • How to run gitlab-runner with docker
      • using vim inside any container without installing it
      • Cannot connect to the Docker daemon at unix:///var/run/docker.sock
      • moving docker images around using ssh and pipe
      • How can I make docker-compose pull images using a socks5 proxy?
  • Stack Overflow
  • Github
  • vmware
    • tools
      • how to install vmware CLI govc on Linux
  • Windows
    • How to Erase a Recovery Partition in Windows
Powered by GitBook
On this page
  • how to run directddmin through a reverse proxy
  • Apache Proxy Module
  • Create a domain or sub.domain.com on DirectAdmin
  • Modify httpd.conf for that user
  • Disable check_referer in directadmin.conf
  • Restart DA and HTTPD
  • Screenshots

Was this helpful?

  1. DirectAdmin

DirectAdmin through a reverse proxy

how to run directddmin through a reverse proxy

how to run directddmin through a reverse proxy

Apache Proxy Module

/usr/sbin/httpd -l | grep mod_proxy
  mod_proxy.c
  mod_proxy_connect.c
  mod_proxy_ftp.c
  mod_proxy_http.c
  mod_proxy_fcgi.c
  mod_proxy_scgi.c
  mod_proxy_uwsgi.c
  mod_proxy_fdpass.c
  mod_proxy_wstunnel.c
  mod_proxy_ajp.c
  mod_proxy_balancer.c
  mod_proxy_express.c
  mod_proxy_hcheck.c

Create a domain or sub.domain.com on DirectAdmin

Modify httpd.conf for that user

for port 80

<VirtualHost 5.63.13.22:80 >
	  ServerName www.directadmin.shakiba.net
	  ServerAlias www.directadmin.shakiba.net directadmin.shakiba.net 
    ProxyRequests Off
    ProxyPass / http://localhost:2222/
    ProxyPassReverse / http://localhost:2222/

    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
</VirtualHost>

for port 443

<VirtualHost 5.63.13.22:443 >
  	SSLEngine on
  	SSLCertificateFile /etc/httpd/conf/ssl.crt/dalogin.crt
  	SSLCertificateKeyFile /etc/httpd/conf/ssl.key/dalogin.key
  	SSLCACertificateFile /etc/httpd/conf/ssl.crt/dalogin.ca
  	ServerName www.directadmin.shakiba.net
  	ServerAlias www.directadmin.shakiba.net directadmin.shakiba.net
  
    # you have other code
    # you have other code
    # you have other code
    
    # Additional parameters for Apache 2.4
    SSLProxyVerify none
    SSLProxyCheckPeerCN Off
    SSLProxyCheckPeerName Off
    ProxyPreserveHost Off

    ProxyRequests Off
    ProxyPass / http://localhost:2222/
    ProxyPassReverse / http://localhost:2222/

    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
</VirtualHost>

note

if we have more than one application to proxy for (here it is DA) it is better to use <location> directive in Apache configuration file like so

    ProxyRequests Off
    
    # first location for root /
    <Location />
        ProxyPass  http://localhost:2222/
        ProxyPassReverse  http://localhost:2222/
    </Location>
    
    # second location for /phpmyadmin
    <Location /phpmyadmin>
        ProxyPass http://localhost/phpmyadmin/
        ProxyPassReverse http://localhost/phpmyadmin/
    </Location>

    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}/$1
</VirtualHost>

Disable check_referer in directadmin.conf

cd /usr/local/directadmin/conf/
vim directadmin.conf

# add
check_referer=0

# save and quit

Restart DA and HTTPD

systemctl restart httpd
systemctl restart directadmin

Screenshots

before login

after login

references

PreviousDirectAdminNextNginx

Last updated 4 years ago

Was this helpful?

https://blog.jmwhite.co.uk/2015/01/02/running-directadmin-through-a-reverse-proxy-with-apache/
http://www.apachetutor.org/admin/reverseproxies
http://apache.webthing.com/