How to manage the aaPanel firewall
Open and close ports, block IP addresses, and configure the built-in firewall in aaPanel. Protect your VPS from unwanted access while keeping web traffic and...
On this page
aaPanel includes a built-in firewall manager under the Security section. It manages UFW (Uncomplicated Firewall) or iptables rules depending on your Linux distribution. Rules set here apply to the OS firewall and control which ports are accessible from the internet.
aaPanel firewall overview
To access the firewall:
- Log in to aaPanel
- Click Security in the left sidebar
- The Firewall tab shows all currently open ports
All unlisted ports are blocked by default. Only ports explicitly added here are accessible from outside the server.
Default open ports
| Port | Protocol | Purpose |
|---|---|---|
| 22 | TCP | SSH access |
| 80 | TCP | HTTP web traffic (required for Let's Encrypt) |
| 443 | TCP | HTTPS web traffic |
| 888 | TCP | phpMyAdmin web interface (default aaPanel) |
| 8888 (or custom) | TCP | aaPanel admin panel |
| 21 | TCP | FTP (if Pure-Ftpd is installed) |
The aaPanel port (default 8888 or a custom value set during install) must be open for you to access the panel. Do not close it without having SSH access as a fallback.
Add a port rule
- Go to Security → Firewall
- Click Add rule
- Enter the port number (single port like
3306, or range like40000-50000) - Select protocol: TCP, UDP, or TCP+UDP
- Optionally restrict to a specific source IP if only one machine should connect
- Click Confirm
Common ports to open on demand:
3306TCP-MySQL remote access (restrict to your IP only)6379TCP-Redis (restrict to localhost or your app server IP)9000TCP-Custom application port40000-50000TCP-FTP passive mode port range
Block an IP address
To block a specific IP from accessing your server:
- Go to Security → IP blocklist (or Blocked IPs tab)
- Enter the IP address or CIDR range (e.g.,
1.2.3.4or1.2.3.0/24) - Click Add
Blocked IPs cannot connect to any port on the server. This is useful for blocking persistent scrapers, brute-force attackers, or known malicious ranges.
Change the panel port
Changing the aaPanel port from the default reduces automated scanning. To change it:
- Go to aaPanel → Panel Settings (top right → Settings or via
bt 14in SSH) - Find Panel port and enter a new port number
- Save-aaPanel restarts on the new port
- Open the new port in the firewall before saving: Security → Firewall → Add rule for the new port
If you change the panel port without opening the new port in the firewall first, you will be locked out of the panel. Open the new port, confirm it is accessible, then close the old panel port.
Manage firewall via SSH
If the panel is inaccessible, manage the firewall directly via SSH:
# View current UFW rules
ufw status numbered
# Allow a port
ufw allow 8888/tcp
# Allow a port from specific IP only
ufw allow from 1.2.3.4 to any port 8888
# Delete a rule by number
ufw delete 3
# Reload
ufw reload
Changes made via SSH are reflected in the aaPanel Security interface when you next load it.
Related: aaPanel security | VPS firewall | CloudPanel firewall | aaPanel login
Need aaPanel hosting?
Install aaPanel on an UnderHost VPS or dedicated server when you want a simple web interface for sites, databases, SSL, and apps.





















