When setting up a VPS for your pet projects, you often need to allow specific applications through UFW (Uncomplicated Firewall). While UFW comes with some pre-defined application profiles, you might need custom ones for your specific use case.
Custom UFW application profiles can be created by adding new files in /etc/ufw/applications.d/
sudo nano /etc/ufw/applications.d/myapp
[MyApp]
title=My Custom Application
description=Custom ports for my application
ports=8080,8081/tcp|9090/udp
sudo ufw app update MyApp
sudo ufw app info MyApp
sudo ufw allow MyApp
Remember to reload UFW after adding profiles:
sudo ufw reload
Here’s an actual profile I use for a Node.js application with WebSocket support:
[NodeApp]
title=Node.js Full Stack App
description=Node.js application with HTTP and WebSocket ports
ports=3000/tcp|3001/tcp|8080/tcp
[MyApp]
: Profile name (used in UFW commands)title
: Short descriptiondescription
: Longer explanationports
: Port definitions Use pipe ( | ) to separate TCP and UDP |