Solved how to force https directadmin

Develop

Verified User
Joined
Jun 9, 2016
Messages
155
Location
Istanbul, TR
Hello all,

I need to force redirect http://xxx.xxx.xxx:2222 to https://server.domain.com
Also for webmail login: http://server.domain.com/roundcube to https://server.domain.com/roundcube

Another question related to this.

I have a server it uses force redirected: https://server.domain.com. I don't use this domain anymore but the server is alive. I want to log in to that server via http://xxx.xxx.xxx:2222. It automatically redirected to the domain and can not open the login page because of this.

I have found that but I am not sure to do that.

https://docs.directadmin.com/webser...ypt-tool-to-secure-port-2222-via-the-hostname

Using the free "Let's Encrypt" tool to secure Port 2222 via the Hostname​

As of DA 1.50.0, we've added a new feature

that allows you to make use of Let's Encrypt
, a tool offering free basic SSL certificates.

We've written the script in such a manner that you can also set up SSL for your hostname and all services in one simple command for your hostname e.g.,:

cd /usr/local/directadmin/scripts
./letsencrypt.sh request_single `hostname` 4096


which will also install the new cert/key/ca files in all respective global places for Apache, Dovecot, Exim, FTP, and DirectAdmin.

NOTE The hostname value, e.g., your.hostname.com must match the "servername" value set in the directadmin.conf, or it will not be in hostname mode, but User domain mode instead.

DirectAdmin should be protected with SSL in 1min when the command finished.
 
Last edited:
If you are using centos 7 you can change your server hostname with putty. You can also login to your server by using http://your-ip:2222/

Command:
Check current hostname: hostnamectl
Change hostname: hostnamectl set-hostname yournewhostnamewritehere

Reboot: reboot
 
1. You can follow the link you provided in this thread to secure DA on port 2222
2. To disable the redirection, check your force_hostname in directadmin.conf make sure it does not have a value then restart DA
 
i tried to use it to redirect but doesn't work anymore.
Oh didn't know that, I still have those lines in my directadmin.conf.

Seems now it works automatically if you enter the correct host. If it doesn't it might be wiser to create a new topic for that.
I presume you created a certificate for your hostname.
 
Back
Top