If you’re looking for a lightweight, single-file database admin tool for PostgreSQL that’s easier to host than phpPgAdmin, Adminer is your best bet. Here’s how to set it up behind Apache on Ubuntu.
Make sure your system is up to date, and install Apache, PHP, PostgreSQL client tools, and Adminer:
sudo apt-get update
sudo apt-get install -y apache2 php libapache2-mod-php postgresql-client adminer
Check your PHP version:
php -v
Note the version (e.g., 8.1) - you’ll need it in the next step.
Enable the PHP module in Apache. Replace php8 with the actual version you found:
sudo a2enmod php8.1
Rather than spinning up a new virtual host, just add Adminer to your default Apache site.
sudo ln -s /usr/share/adminer/adminer /var/www/html/adminer
sudo nano /etc/apache2/sites-available/000-default.conf
Add this inside the <VirtualHost *:80> block:
Alias /adminer /usr/share/adminer
<Directory "/usr/share/adminer">
Require all granted
DirectoryIndex adminer.php
</Directory>
<Location /adminer>
ProxyPass !
</Location>
Make sure permissions are set correctly:
sudo chown -R www-data:www-data /usr/share/adminer
sudo chmod -R 755 /usr/share/adminer
Restart the web server to apply changes:
sudo a2ensite 000-default
sudo systemctl restart apache2
To debug errors:
sudo tail -f /var/log/apache2/error.log
http://your-server-ip/adminer