Bobcares

Directadmin default port – Why to change it during migration

by | Jul 19, 2019

Server migration always involve changes.

For example, migration from cPanel to DirectAdmin changes port from 2086 to 2222. And this often breaks book-marked control panel link in user’s browser.

Fortunately, there are ways to change DirectAdmin default port. This comes handy for users.

As part of our Migration Services, we always think of customers and keep changes to a minimum.

Today, we’ll see how our Migration Specialists configure DirectAdmin default port similar to cPanel and make things easier for users.

 

How migration affect users?

Migration definitely bring in changes. And, when migrating from cPanel to DirectAdmin involves changes in control panel link, port, folder structure and many more.

For example, in a cPanel server, users access the panel at https://domain.com:2082 and WHM at port 2086. When coming to DirectAdmin, the control panel link becomes http://domain.com:2222.

This becomes a problem for normal users. They prefer to save their control panel link in the browser settings. In such cases, it becomes really helpful if we can change the DirectAdmin port to what cPanel uses.

Of course, this applies only to certain users. And, in such servers our Migration Engineers take special care in retaining the old server settings.

 

How we set DirectAdmin default port to 2086?

By default, we access direct admin control panel by using the port number 2222. Let’s take a look on what it takes it to make DirectAdmin listen on port 2086.

Firstly, we connect to the DirectAdmin server as root user via SSH. The port settings of DirectAdmin are explained in the file /usr/local/directadmin/conf/directadmin.conf

Therefore, to change default DirectAdmin port to 2086, our Migration Engineers edit the configuration file and change the port number value. The entry will look like:

port=2222

We, then save the directadmin.conf file.  Additionally, we edit the file /var/www/html/redirect.php and replace the old port number with the new one.

Here, we open port 2086 in server firewall.

Finally, to make the changes effective, we restart the DirectAdmin using:

[root@myDAserver #] service directadmin restart

Now DirectAdmin will be loading on port 2086.

Make DirectAdmin accessible at Domain/cpanel

Similarly, cPanel servers allow users to access the cPanel at http://domainname/cpanel. Thus users need not remember the port settings of control panel. And, many server owners would like to replicate this setting in DirectAdmin servers too.

To bring in the change, we need to add an Alias for cpanel in the web server configuration. Let’s take a look on how our Migration Specialists make it working.

Create a folder with name cpanel at /var/www/html using the command:

mkdir /var/www/html/cpanel

Now we create an index page and add the DirectAdmin control panel link to it. For this, we execute:

echo "<?php header('location: https: //serverhostname .com:2222');exit; ?>" > /var/www/html/cpanel/index.php

Here, we need to substitute the serverhostname and DirectAdmin port to match the server settings. If DA runs on port 2086, we set the link as http://server:2086.

Now we need to add the cpanel alias to the custom webapps list. We add the following entry in the file /usr/local/directadmin/custombuild/custom/webapps.list

cpanel=/var/www/html/cpanel

It’s time now to rewrite the configs for the web server.

./build rewrite_confs

Then, these changes will show up in the web server config file. For example, when using Apache, the changes will be in
/etc/httpd/conf/extra/httpd-alias.conf. And, if Nginx is the web server, it will make changes in /etc/nginx/webapps.conf.

Finally, we do a configuration check and restart Apache using the command:

httpd -k restart

For Nginx, we use service nginx restart.

That’s it. The DirectAdmin panel will be accessible at /cpanel link now.

 

Common errors with DirectAdmin port change

However, from our expertise in managing servers, we often see users struggling with DirectAdmin default port change. Let’s see how our Migration Engineers correct it.

 

1. Firewall settings

Many times, server owners make port changes in DirectAdmin config file, but forget to open custom port in firewall. This makes panel unavailable.

To fix the error, we open port in the server firewall. When the server is using CSF, we modify the file /etc/csf/csf.conf and add the new port in TCP_IN, TCP6_IN and PORTS_directadmin.

After restarting CSF, the DirectAdmin becomes accessible on custom port.

 

2. Direct editing of config files

Again, many server owners edit the Apache configuration file of DirectAdmin server at /etc/httpd/conf/extra/httpd-alias.conf directly.  DirectAdmin never recommends editing httpd-alias.conf directly, as it gets overwritten at the next update. As a result, all custom settings will be lost.

Therefore, our Migration Engineers always use the CustomBuild method to update DirectAdmin settings. We add the customization to the webapps list. Then reconfigure using the build command. This keep the changes on the server even after updates.

[Looking for changing DirectAdmin default port? We can do it right-away.]

 

Conclusion

To summarize, changing DirectAdmin default port involves editing the configuration and firewall. These custom ports can eliminate the need for switching ports after server migration. Today, we saw how our Migration Specialists make cPanel to DirectAdmin migration hassle free.

Migrate cPanel to a new platform!

Looking for changing infrastructure of your server? Let us help you.

Our migration experts can migrate all your accounts to a new platform without data loss.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.