PortGate

Free tools

Security checklists

Choose where it runs and what it is built with, from WordPress to Kubernetes and self-hosted AI models. You get a checklist with why each step matters and the commands to check and fix it. Tick items off as you go; your progress stays in this browser.

What is it built with? (pick everything that applies)

Web server

App or framework

Database and search

Infrastructure and delivery

AI and LLM

Popular: Ubuntu + Nginx + WordPress + MySQL · Ubuntu + Nginx + Laravel + MySQL + Redis · Ubuntu + Docker + Node.js + PostgreSQL · Rails on a cloud VM behind Cloudflare · Rocky Linux + Apache + PHP + MySQL · Self-hosted LLM with RAG (Ollama, Qdrant) · AI agent app on a platform · Go and AI on Kubernetes · WordPress on shared hosting

Security checklist: Ubuntu or Debian VPS with Nginx, WordPress, MySQL or MariaDB

Server and SSH

0 of 11 done

  1. Work as a normal user with sudo, not as root

    High

    Mistakes and stolen sessions as root can change everything on the box. A named user also leaves a clearer audit trail.

    Check which users can sudo

    getent group sudo

    Fix (replace deploy with your username)

    sudo adduser deploy
    sudo usermod -aG sudo deploy
    # copy your key so the new user can log in
    sudo rsync --archive --chown=deploy:deploy ~/.ssh /home/deploy
  2. Turn off SSH password logins

    Critical PortGate Server Guard checks this

    Bots try passwords against every public SSH server, all day. With keys only, guessing is useless. Test a key login in a second terminal before you close the first one.

    Check (both should say no)

    sudo sshd -T | grep -Ei '^(passwordauthentication|kbdinteractiveauthentication) '

    Fix (a drop-in that wins over cloud-init's 50-cloud-init.conf)

    printf 'PasswordAuthentication no\nKbdInteractiveAuthentication no\n' | sudo tee /etc/ssh/sshd_config.d/00-hardening.conf
    sudo sshd -t && sudo systemctl reload ssh
  3. Stop root logging in with a password

    Critical PortGate Server Guard checks this

    Root is the one username every attacker knows. prohibit-password keeps key-based root access working if you rely on it; use no once you log in as your own user.

    Check (want without-password, which is how sshd shows prohibit-password, or no)

    sudo sshd -T | grep -i '^permitrootlogin '

    Fix

    echo 'PermitRootLogin prohibit-password' | sudo tee /etc/ssh/sshd_config.d/01-root.conf
    sudo sshd -t && sudo systemctl reload ssh
  4. Turn the firewall on, deny incoming by default

    Critical PortGate Server Guard checks this

    Anything that starts listening later (a debug server, a database) stays private unless you open it on purpose. Allow your SSH port first so you do not lock yourself out.

    Check

    sudo ufw status verbose

    Fix (change 22 if SSH runs on another port)

    sudo ufw allow 22/tcp
    sudo ufw allow 80/tcp
    sudo ufw allow 443/tcp
    sudo ufw default deny incoming
    sudo ufw enable
  5. Only the ports you expect face the internet

    Critical PortGate Server Guard checks this

    Databases, caches and admin panels left on 0.0.0.0 are found by scanners within hours. Docker-published ports skip UFW, so check what is listening, not just your firewall rules.

    Check (anything on 0.0.0.0 or [::] besides 22, 80 and 443 needs a reason)

    sudo ss -tulpn | grep -Ev '127\.0\.0\.1|\[::1\]'

    Check from outside (run on another machine)

    nmap -Pn --top-ports 1000 example.com
  6. Install security updates automatically

    High

    Most break-ins use bugs that were patched weeks earlier. Automatic security updates close that gap without you remembering to log in.

    Check

    systemctl is-enabled unattended-upgrades && cat /etc/apt/apt.conf.d/20auto-upgrades

    Fix

    sudo apt update && sudo apt install -y unattended-upgrades
    sudo dpkg-reconfigure -plow unattended-upgrades
  7. Reboot after kernel and library updates

    Medium

    Updates to the kernel, OpenSSL or glibc only protect you once the server restarts. Pick a quiet time each week.

    Check

    [ -f /var/run/reboot-required ] && cat /var/run/reboot-required.pkgs || echo "no reboot needed"
  8. Ban addresses that keep failing to log in

    Medium PortGate Server Guard checks this

    Even with keys only, brute-force traffic fills logs and wastes CPU. Fail2ban blocks an address after repeated failures.

    Check

    sudo fail2ban-client status sshd

    Fix (Debian and Ubuntu enable the sshd jail by default)

    sudo apt install -y fail2ban && sudo systemctl enable --now fail2ban
  9. Review who logged in

    Medium PortGate Server Guard checks this

    A login you do not recognise is the earliest sign of a stolen key or password.

    Recent logins

    last -a | head -20

    Successful SSH logins today

    sudo journalctl -u ssh --since today | grep -i accepted
  10. Keep the clock in sync

    Medium

    Wrong time breaks TLS, two-factor codes and log timelines when you investigate an incident.

    Check (want System clock synchronized: yes)

    timedatectl status
  11. Back up off the server and test a restore

    High

    Ransomware, a bad deploy or a provider outage can take the server and its local backups together. A backup you have never restored is a guess.

    Example with restic to S3-compatible storage

    restic -r s3:https://s3.example.com/my-bucket init
    restic -r s3:https://s3.example.com/my-bucket backup /var/www /etc
    restic -r s3:https://s3.example.com/my-bucket snapshots

    Test a restore into a scratch folder

    restic -r s3:https://s3.example.com/my-bucket restore latest --target /tmp/restore-test

Nginx

0 of 7 done

  1. Serve every site over HTTPS with automatic renewal

    Critical PortGate domain monitoring checks this

    Expired certificates take sites down and teach visitors to click through warnings.

    Fix

    sudo certbot --nginx -d example.com -d www.example.com

    Check renewal works

    sudo certbot renew --dry-run
  2. Block .env, .git and other dotfiles

    Critical PortGate domain monitoring checks this

    An exposed .env leaks database passwords and API keys; an exposed .git leaks your source. Bots request both on every site.

    Check (want 403 or 404)

    curl -s -o /dev/null -w '.env %{http_code}\n' https://example.com/.env
    curl -s -o /dev/null -w '.git %{http_code}\n' https://example.com/.git/config

    Fix (inside each server block, keeps /.well-known for certificates)

    location ~ /\.(?!well-known) {
        deny all;
    }
  3. Send security headers

    High PortGate domain monitoring checks this

    HSTS keeps browsers on HTTPS, nosniff and frame headers block common content and clickjacking tricks.

    Check

    curl -sI https://example.com | grep -Ei 'strict-transport|x-content-type|x-frame|referrer-policy|content-security'

    Fix (in the HTTPS server block)

    add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
    add_header X-Content-Type-Options "nosniff" always;
    add_header X-Frame-Options "SAMEORIGIN" always;
    add_header Referrer-Policy "strict-origin-when-cross-origin" always;
  4. Hide the Nginx version

    Medium

    The version number tells scanners exactly which known bugs to try.

    Check

    curl -sI https://example.com | grep -i '^server:'

    Fix (in the http block of nginx.conf)

    server_tokens off;
  5. Allow only TLS 1.2 and 1.3

    Medium

    TLS 1.0 and 1.1 have known weaknesses and every current browser supports 1.2 or newer.

    Check (TLS 1.1 should fail to connect)

    openssl s_client -connect example.com:443 -tls1_1 </dev/null 2>&1 | grep -Ei 'handshake failure|alert|no protocols|Cipher is'

    Fix (http or server block)

    ssl_protocols TLSv1.2 TLSv1.3;
  6. Rate-limit login and API endpoints

    Medium

    Slows down password guessing and stops one client from exhausting the server.

    Fix (zone in the http block, limit in the location)

    limit_req_zone $binary_remote_addr zone=login:10m rate=5r/m;
    
    location = /login {
        limit_req zone=login burst=5 nodelay;
        # your existing proxy_pass or try_files line
    }
  7. Test the config before every reload

    Medium

    A typo in a reload can take every site on the server down.

    Always

    sudo nginx -t && sudo systemctl reload nginx

WordPress

0 of 9 done

  1. Keep core, plugins and themes updated

    Critical

    Outdated plugins are the most common way WordPress sites get hacked.

    Check

    wp core check-update && wp plugin list --update=available && wp theme list --update=available

    Fix

    wp core update && wp plugin update --all && wp theme update --all
  2. Delete plugins and themes you do not use

    High

    Deactivated plugins can still be attacked directly through their files.

    Check

    wp plugin list --status=inactive && wp theme list --status=inactive

    Fix

    wp plugin delete plugin-slug
  3. Review administrators and require two-factor sign-in

    Critical

    An extra admin account is a common backdoor after a break-in.

    Check

    wp user list --role=administrator --fields=ID,user_login,user_email,user_registered
  4. Stop PHP running in the uploads folder

    Critical PortGate Malware Guard checks this

    Attackers upload webshells disguised as images; if PHP cannot run there, the shell is dead weight.

    Check (should print nothing)

    find wp-content/uploads -type f -name '*.php'

    Fix on Nginx

    location ~* /wp-content/uploads/.*\.php$ {
        deny all;
    }
  5. Turn off the theme and plugin editor

    High

    A stolen admin login otherwise becomes code execution through Appearance, Theme File Editor.

    Fix

    wp config set DISALLOW_FILE_EDIT true --raw
  6. Verify core and plugin files against WordPress.org

    High PortGate Malware Guard checks this

    Changed core files are a strong sign of a hack.

    Check

    wp core verify-checksums && wp plugin verify-checksums --all
  7. Lock down wp-config.php

    High

    It holds the database password and secret keys.

    Check

    ls -l wp-config.php

    Fix

    chmod 640 wp-config.php
  8. Block xmlrpc.php if you do not use it

    Medium

    XML-RPC lets attackers try many passwords per request. Jetpack and some mobile apps need it, so check first.

    Check (405 or 403 means blocked)

    curl -s -o /dev/null -w '%{http_code}\n' -X POST https://example.com/xmlrpc.php

    Fix on Nginx

    location = /xmlrpc.php {
        deny all;
    }
  9. Keep debug output off in production

    Medium

    Debug output shows file paths and sometimes database errors to visitors.

    Check (want false)

    wp config get WP_DEBUG

MySQL and MariaDB

0 of 4 done

  1. Listen on localhost only

    Critical PortGate Server Guard checks this

    A database on the internet gets password guesses and exploit attempts all day.

    Check (want 127.0.0.1:3306)

    sudo ss -ltnp | grep 3306

    Fix (under [mysqld], then restart)

    bind-address = 127.0.0.1
  2. Remove anonymous users, the test database and remote root

    Critical

    Default installs can leave accounts that need no password.

    Check

    sudo mysql -e "SELECT user, host FROM mysql.user;"

    Fix

    sudo mysql_secure_installation
  3. Give the app its own user with only the rights it needs

    High

    If the app is hacked, the attacker gets one database, not all of them.

    Fix

    CREATE USER 'app'@'localhost' IDENTIFIED BY 'a-long-random-password';
    GRANT SELECT, INSERT, UPDATE, DELETE ON app.* TO 'app'@'localhost';
  4. Back up the database daily and test a restore

    High

    A backup you have not restored is a guess.

    Example (crontab)

    0 3 * * * mysqldump --single-transaction --routines app | gzip > /var/backups/app-$(date +\%F).sql.gz

Commands are for Ubuntu or Debian VPS. Read each one before you run it, test on a staging server where you can, and keep an SSH session open while you change SSH or firewall settings.