How to setup SSH, Nginx, UFW, and MySQL on a new Ubuntu Server

This quick guide will show you how to set up an NGINX and UncomplicatedFirewall on an Ubuntu Server

Update Packages to bring your system up to date. This is a standard command that Debian/Ubuntu sysadmins run before installing new packages.

sudo apt update

Install NGINX:

sudo apt install nginx

Enable UFW:

sudo ufw enable

Check which pre-built firewall configurations are available:

sudo ufw app list

Add new configurations for your server:

sudo ufw allow 'Nginx Full'
sudo ufw allow 'Nginx HTTP'
sudo ufw allow 'Nginx HTTPS'
sudo ufw allow 'OpenSSH'

Check that NGINX is started:

systemctl status nginx

Install MySQL Server:

sudo apt install mysql-server

Setup password and security for the MySQL server:


You are now ready to start using your new web and database server.

More UFW Commands

See status

sudo ufw status

See rules numbered

sudo ufw status numbered

See Also

Share this article

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to Top