Intermediate
How to configure a firewall on Hostinger
Quick Answer
Use Hostinger's managed VPS firewall in hPanel: create a firewall group, add accept rules for ports 22 (SSH), 80 (HTTP), and 443 (HTTPS) from anywhere, then activate it. This drops all other incoming traffic by default, so always add SSH rule first to avoid lockouts. Test ports after activation using telnet or SSH.
Prerequisites
- Active Hostinger VPS
- hPanel access credentials
- SSH details (IP and root password/key)
- Basic knowledge of ports and protocols
- Server backup or snapshot
1
Log in to hPanel and select VPS
Log in to your hPanel at hPanel.hostinger.com and navigate to the VPS section. Select the VPS server you want to configure by clicking on it.
2
Access Firewall settings
In the left sidebar, click Security → Firewall (or directly Firewall in some views).
3
Create new firewall group
Click Add Firewall (or + Add New Firewall Rule / Create firewall configuration). Enter a firewall name (e.g., "main-firewall") and click Create.
Tip
Choose a descriptive name like 'web-ssh-firewall' for easy management.
4
Edit the firewall group
Locate the new firewall group in the list, click the ellipsis button (⋯) next to it, and select Edit.
5
Add SSH rule (port 22)
In the Add firewall rule section: Select action: Accept, protocol: TCP, port: 22, traffic source: Anywhere (0.0.0.0/0). Click Add rule. Always add this first to prevent lockout.
Tip
Test SSH before proceeding:
telnet YOUR_VPS_IP 22.6
Add HTTP rule (port 80)
Add another rule: action: Accept, protocol: TCP, port: 80, source: Anywhere. Click Add rule.
7
Add HTTPS rule (port 443)
Add final basic rule: action: Accept, protocol: TCP, port: 443, source: Anywhere. Click Add rule.
Tip
For custom apps, add their ports (e.g., TCP 3000:4000).
8
Save and apply rules
Click Save or Apply to update the firewall group.
9
Activate the firewall
Return to the Firewall list, find your group, click the ellipsis (⋯), and select Activate (toggle on). Wait up to 5 minutes for activation.
Tip
Monitor status; it shows as enabled when active.
10
Test and verify
Test ports: SSH to port 22, browse HTTP/HTTPS on 80/443. Use
telnet YOUR_VPS_IP 22 or telnet YOUR_VPS_IP 80 from terminal.Tip
If issues arise, deactivate via hPanel and re-edit.
Troubleshooting
Locked out of SSH (port 22) after activation
Deactivate firewall via hPanel → VPS → Firewall (wait 5 mins), add Accept TCP 22 Anywhere rule first, reactivate, and test with
telnet YOUR_VPS_IP 22.Website inaccessible (ports 80/443)
Ensure Accept TCP rules for ports 80 and 443 from Anywhere are added and saved before activation. Test with browser or
telnet YOUR_VPS_IP 443.Firewall activation takes too long
Wait up to 5 minutes as shown in hPanel status. If stuck, refresh page or check VPS overview for errors.
Custom app ports blocked
Edit firewall group via ellipsis → Add rule for your app's protocol/port (e.g., TCP 3000), source Anywhere or specific IP/CIDR, save, and reactivate.
Need to reset firewall
In VPS dashboard, find Reset firewall configuration option under Main settings and click Reset, then reconfigure.
Ready to get started with Hostinger?
Put this tutorial into practice. Visit Hostinger and follow the steps above.
Visit Hostinger →