Home WebServer PanelCentOS Web Panel How to change the port on CentOS Web Panel (CWP)

How to change the port on CentOS Web Panel (CWP)

by Thạch Phạm
Published: Last Updated on

In today’s article, AZDIGI will show you how to change the port on CentOS Web Panel (CWP) in the most detail.

I. Overview

When you install CentOS Web Panel (CWP), the console access ports are 2030 (without SSL) and 2031 (with SSL).

If you want to change to another port to increase security and make it easier to remember, you can follow the steps below.

II. Change port on CentOS Web Panel (CWP)

To change the port on CentOS Web Panel (CWP), we need to follow these 4 steps:

Step 1: Log in to CentOS Web Panel as root

To log in to CentOS Web Panel with the root account, we access the following path on the browser (remember to change the IP to your CWP server’s IP address) with the login port of 2031.

AZDIGI Tutorial

Remember to change IP to the IP address your CentOS Web Panel server is using.

Below is my CentOS Web Panel interface:

image 1
The interface of CentOS Web Panel (CWP) as root.

After entering the CWP interface, we continue with step 2 to open the port on CSF you want to use.

Step 2: Open Port on CentOS Web Panel (CWP) with CSF

In the feature list on the left of the screen, we select Security => CSF Firewall as shown below:

Screen Shot 2020 12 03 at 2.37.17 PM

At the interface of the CSF feature, click Firewall Configuration.

Part of the CSF interface on the CentOS Web Panel.

At the next interface, find Allow outgoing TCP ports and add the 2 ports you want before the double quotes as shown below (remember that between different ports will need commas)

The interface opens the outcoming port on the CSF.

In addition, you need to add these 2 ports in the PORTS_cwp section.


After adding the port you need, press Save changes button.

image 7

After opening the port on CSF, we proceed to change the port on CentOS Web Panel (CWP) with SSH in step 3 and step 4.

Step 3: SSH into your CentOS Web Panel (CWP) system

To change the port on CentOS Web Panel (CWP), we first need to SSH into your VPS/Server as root. If you don’t know how to SSH into your VPS/Server, you can refer to the following tutorial:

After successfully SSH, we continue with step 4 to perform port change commands on CentOS Web Panel (CWP).

Step 4: Change the port on CentOS Web Panel (CWP) via SSH

I want to change Port 2030 to Port 6868 and Port 2031 to Port 6969, so I will replace the configuration parameters of the CentOS Web Panel in the following file:

AZDIGI Tutorial

After replacing and saving the configuration, we use the following command to recheck it:

AZDIGI Tutorial
grep -n listen /usr/local/cwpsrv/conf/cwpsrv.conf

If the parameters display the ports correctly you have changed as shown below, it is successful.


Then we need to restart CentOS Web Panel to get the new configuration parameters. To restart CentOS Web Panel and CSF, run the following command:

AZDIGI Tutorial
sh /scripts/restart_cwpsrv
csf -r

Finally, you can connect to the new port that you changed.


After accessing the new port, you can delete the 2 old ports in CSF to increase security.

III. Summary

With just 4 simple steps above, you can change the CentOS Web Panel (CWP) port. Customizing the login port will make your CentOS Web Panel more secure than leaving the default port.

Hope this article will be of help to you. Wishing you success!

See more useful articles about CentOS Web Panel at the following link:

If you need assistance, you can contact support in the ways below:

Đánh giá

Tham gia nhóm hỗ trợ Server - Hosting

Tham gia nhóm Hỗ trợ Server - Hosting & WordPress để cùng nhau hỏi đáp và hỗ trợ các vấn đề về WordPress, tối ưu máy chủ/server.

Tham gia ngay

Bài viết cùng chuyên mục

AZDIGI – Không chỉ là đơn vị hàng đầu trong lĩnh vực Web Hosting và Máy chủ, chúng tôi mong muốn mang lại những kiến thức bổ ích nhất và luôn cập nhật thường xuyên cho cộng đồng người đam mê thiết kế website, công nghệ,…

Vui lòng không sao chép nội dung nếu chưa xin phép. Designed and Developed by PenciDesign