This is a follow up post on my previous article about changing the admin port for VestaCP (found here)
For a new project I decided to install VestaCP on a server I have from LittleHappyCloud.net. LHC is a KVM server that doesn’t have a dedicated IPv4, you get 20 forwarded ports on the IPv4 and port 80 is forwarded based on added domain names in the VPS Control Panel.
This means that the default VestaCP admin port needs to be changed if you should be able to connect to the admin interface over IPv4. In my previous article I showed you how you changed the settings via the admin interface but that is impossible to reach unless you use IPv6.
To accomplish this from the shell we need to execute the following commands as root;
Update the firewall rules
If you have iptables installed we first have to find the firewall rule that opens the VestaCP admin port and update this to the new port that we will use.
1 |
v-list-firewall |
Will return the list of active firewall rules, it may look something like this
1 2 3 4 5 6 7 8 9 10 11 12 13 |
ACTION PROTOCOL PORT IP ------ ------ ------ ------ ACCEPT ICMP 0 0.0.0.0/0 ACCEPT TCP 8083 0.0.0.0/0 ACCEPT TCP 3306,5432 0.0.0.0/0 ACCEPT TCP 143,993 0.0.0.0/0 ACCEPT TCP 110,995 0.0.0.0/0 ACCEPT TCP 25,465,587,2525 0.0.0.0/0 ACCEPT UDP 53 0.0.0.0/0 ACCEPT TCP 21 0.0.0.0/0 ACCEPT TCP 80,443 0.0.0.0/0 ACCEPT TCP 22 0.0.0.0/0 ACCEPT TCP 53 0.0.0.0/0 |
From the above result we see that the second row is the VestaCP Admin port (8083) and this is the rule that we should update.
Using the above information, the LHC assigned port 11601 and the VestaCP command v-change-firewall-rule and parameters will look like this:
1 |
v-change-firewall-rule 2 ACCEPT 0.0.0.0/0 11601 TCP VestaAdmin |
There, the port is now accessible over IPv4. Now we need to change the listening port of VestaCP.
I have copied the last part of Part 1 and updated it according to my example above.
Changing the admin port
Make a backup of the config file and then open the original configuration file with your favourite editor (mine is nano)
1 |
editor /usr/local/vesta/nginx/conf/nginx.conf |
about a page down in the configuration file you should find this section
1 2 3 |
# Vhost server { listen 8083; |
change the port number on the row that starts with listen and it should now look like this:
1 2 3 |
# Vhost server { listen 11601; |
Exit and save the configuration file.
restart the service by running this command:
1 |
/etc/init.d/vesta restart |
and you should now be able to access your admin web interface on the new port https.//<your_server_ip>:11601
Enjoy!
2 comments for “VestaCP – Change listening port admin interface (Part 2)”