Install Nginx
Verify the version:
Firewall
sudo ufw allow 'Nginx Full'
sudo ufw allow 'Nginx Full'
UFW ships with predefined app profiles.
'Nginx Full' opens both port 80 (HTTP) and port 443 (HTTPS). There are also 'Nginx HTTP' (80 only) and 'Nginx HTTPS' (443 only) if you want to be more restrictive — but since SSL gets added later via Certbot, both ports need to be open, so Full is correct here.sudo ufw allow OpenSSH
sudo ufw allow OpenSSH
Opens port 22 (SSH). This step is critical — if UFW is enabled without explicitly allowing SSH first, you’ll lock yourself out of the VPS the moment the firewall activates, since UFW defaults to denying all incoming connections.
sudo ufw --force enable
sudo ufw --force enable
Turns the firewall on. By default
ufw enable asks for a y/n confirmation (since it could disrupt active SSH sessions) — --force skips that prompt, which is useful for scripting/automation but means you must be 100% sure SSH is already allowed before running it.Confirm the rules took effect:
Example reverse proxy config
/etc/nginx/sites-available/j-optic-backend: