Created
December 2, 2020 22:14
-
-
Save dantullis/541482673ceb435cd1cd29957f154867 to your computer and use it in GitHub Desktop.
Setup a basic UFW firewall on Ubuntu 20.04
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
echo " | |
------------------------------------------------- | |
Setting Up a Basic UFW Firewall on Ubuntu 20.04 | |
------------------------------------------------- | |
" | |
# To run: | |
# curl <raw URL>/setup-basic-ufw-firewall-ubuntu-20-04.sh | sudo bash | |
# From: | |
# https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-20-04 | |
# and | |
# https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-ubuntu-20-04 | |
# Have firewall allow SSH connections so that we can log back in next time | |
sudo ufw allow OpenSSH | |
# This profile opens both port 80 (normal, unencrypted web traffic) and port 443 | |
sudo ufw allow 'Nginx Full' | |
# enable the firewall | |
sudo ufw --force enable | |
# Verify with: sudo ufw status |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment