How to Install Adminer on Your VPS — simple, plain, step-by-step (MySQL example)

How to Install Adminer on Your VPS — simple, plain, step-by-step (MySQL example)

#DatabaseManagement #VPSHosting #WebDevelopment

If you know phpMyAdmin (for MySQL) or MongoDB Compass (for MongoDB), Adminer does basically the same thing: it gives you a clean browser interface to manage and manipulate databases — browse tables, run queries, edit rows, export/import data, create users, etc.Adminer works with MySQL/MariaDB, PostgreSQL, SQLite, MS SQL, Oracle (and more via plugins). In this guide I’ll show a short, clear process to install Adminer for MySQL on a VPS with Nginx + PHP-FPM. I’ll include the exact SSH step, version checks, an IP-or-domain setup, and optional SSL.

Copy-ready steps

Step 0 — SSH into your VPS

Open your terminal and connect: (Replace ubuntu, and YOUR_VPS_IP with your values.)

ssh ubuntu@YOUR_VPS_IP        

Step 1 — Check what’s already installed

Run these to see what you have:

php -v            # PHP version
mysql --version   # MySQL
nginx -v          # Nginx version        

Step 2 — Install missing components (Ubuntu/Debian example)

If PHP or drivers are missing:

sudo apt update
sudo apt install -y php-fpm php-mysql wget
        

Step 3 — Confirm PHP version and PHP-FPM socket

Get your PHP version (you’ll need it for Nginx config):

php -v
php -r 'echo PHP_VERSION, "\n";'        

Step 4 — Create a folder & download Adminer

sudo mkdir -p /var/www/adminer
cd /var/www/adminer

# Official recommended latest build:
sudo wget https://www.adminer.org/latest.php -O index.php        

Step 5 — Set permissions

sudo chown -R www-data:www-data /var/www/adminer
sudo chmod -R 755 /var/www/adminer
        

Step 6 — Nginx configuration (IP or domain)

You can use your server IP or a domain that points to the IP. If you use a domain, make sure the domain’s A record points to your VPS IP first.

Create site file:

sudo nano /etc/nginx/sites-available/adminer
        

Minimal Nginx server block (works with an IP or domain). Change the PHP socket path to match your system:

server {
    listen 80;
    server_name YOUR_IP_OR_DOMAIN;

    root /var/www/adminer;
    index index.php;

    location / {
        try_files $uri $uri/ =404;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;  # <-- replace with your socket
    }

    # Optional: deny directory listing
    location ~ /\.ht {
        deny all;
    }
}
        

Enable and test:

sudo ln -s /etc/nginx/sites-available/adminer /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx
        

If you use a domain and want HTTPS, see the Optional SSL section below.


Step 7 — Open Adminer in your browser

  • Using IP: http://YOUR_VPS_IP/
  • Using domain: http://your-domain.com/ You’ll see the Adminer login form — enter your DB connection details (server, username, password, database).


Optional — Install SSL (if you used a domain)

If your server_name is a domain (DNS A record points to your IP), secure it with Let's Encrypt + Certbot:

sudo apt install -y certbot python3-certbot-nginx
sudo certbot --nginx -d your-domain.com -d www.your-domain.com
        

Certbot will automatically create/adjust an Nginx config with HTTPS and renewals.

If you use ufw firewall, allow Nginx traffic:

sudo ufw allow 'Nginx Full'
sudo ufw enable    # only if UFW is not yet enabled and you're sure
        

(If you don’t use UFW, use your cloud provider's firewall rules.)


Security — important (do not skip)

Adminer is powerful — protect it:

  • Don’t expose Adminer to the whole internet. Restrict access by IP, or require authentication.
  • Add HTTP Basic Auth:
  • Or restrict by IP:
  • Rename index.php to a less obvious filename, e.g. adm1n_42.php, and update Nginx index directive — this is not a replacement for proper access controls but reduces random scans.
  • Keep Adminer updated — use latest.php or check releases.


Quick troubleshooting

  • 502 Bad Gateway → PHP-FPM is down or socket path is wrong. Check with sudo systemctl status php*-fpm and confirm the socket in /var/run/php/.
  • 404 → Wrong root or file missing (/var/www/adminer/index.php) or permissions.
  • Can’t connect to DB → Check DB server host (localhost vs 127.0.0.1), ports, firewall, and credentials.
  • Blocked by firewall → Ensure ports 80/443 are allowed.

👉 If you found this helpful, remember to comment and share. You can also explore more of my work here: https://jamesgiteredev.site/

#MySQL #Adminer #Nginx #PHPFPM #DevOps #CloudComputing #BackendDevelopment


To view or add a comment, sign in

More articles by James Gitere

Others also viewed

Explore content categories