This article describes how to modify the default port used by Directadmin to log on to the background, one is through ssh and the other is modified in the system, as shown below.
Method 1
1. log on to your VPS or server through SSH as the root account;
2. Execute the following twoCommandYou can modify the default port to 12345. You can modify the bold 12345 in the following statement to any other port and then executeCommand;
Sed-I's/port = 2222/port = 12345/G'/usr/local/directadmin/conf/directadmin. conf
Service directadmin restart
Method 2
In fact, it is almost the same as above, but it is a lot of trouble. Execute the following statement:
Vi/usr/local/directadmin/conf/directadmin. conf
Find port = 2222 in it, change the port number to the port number you want, for example, 12345, save and exit, and then run the following statement to restart DirectAdmin.
Service directadmin restart
OK. You can modify the default port 12345 in the preceding command to any other port and then execute the command;
Do not conflict with common ports. We recommend that you change it to 5-bit, but not higher than 65535.
DirectAdmin modify default http port
# Vi/etc/httpd/conf/httpd. conf1 Listen 8080
# Vi/etc/httpd/conf/ips. conf1 NameVirtualHost *: 8080
Go to the/usr/local/directadmin/data/templates directory and modify the default port 80,443 of the following template file.
Ips_virtual_host.conf
Virtual_host.conf
Virtual_host_sub.conf
Virtual_host2.conf
Virtual_host2_sub.conf
Redirect_virtual_host.conf
Change the default display page.
Vi/var/www/html/index.html
Note:
If your server has enabled the previously mentioned automatic IP address locking or using the iptable firewall, you may use the new port number but cannot access the management background. In this case, you have to update the port in the iptable firewall, because port 2222 is opened by default, and the port you changed is not in the Development list.
Run the following statement:
Vi/etc/init. d/iptables
Find "2222" in it, change the port number to the port number you want, such as "12345", save and exit, and then execute the following statement to restart iptable to make it take effect:
/Etc/init. d/iptables restart
Work done