Era Host hosting
EraHost – Free Domain, Cheap Hosting!
Client Area
Support 24/7
Menu

Enable SSL for Secure phpMyAdmin Access in VestaCP

3 min read
19.04.2026

By default, phpMyAdmin in VestaCP is accessible via HTTP, which is not secure. To prevent unauthorized access and data interception, it is important to enable SSL (HTTPS) for phpMyAdmin.

Enable SSL for phpMyAdmin in VestaCP
Putting phpMyAdmin behind HTTPS on a VestaCP server.

For phpMyAdmin in general (install, security, day-to-day use), see phpMyAdmin — Installation, Configuration & Usage. For the broader VestaCP context, see VestaCP Hosting — Everything You Need to Know and How to Install VestaCP on a VPS/Server.

Verify SSL Certificate

Before forcing SSL for phpMyAdmin, ensure that your domain has an SSL certificate installed. You can check if SSL is already enabled by running:

sudo ls /usr/local/vesta/ssl

If you see .crt and .key files, SSL is installed.

Edit the phpMyAdmin Nginx Configuration

  1. Open the configuration file for phpMyAdmin:
  2. sudo nano /etc/nginx/conf.d/phpmyadmin.conf
  3. Modify the configuration to force HTTPS:
    • Find the HTTP (port 80) block and update it to redirect to HTTPS:
server {

    listen 80;

    server_name your-domain.com;

    return 301 https://your-domain.com$request_uri;

}
  • Ensure your HTTPS (port 443) block contains the correct SSL paths:
server {

    listen 443 ssl;

    server_name your-domain.com;



    ssl_certificate /usr/local/vesta/ssl/certificate.crt;

    ssl_certificate_key /usr/local/vesta/ssl/certificate.key;



    location /phpmyadmin {

        alias /usr/share/phpMyAdmin;

        index index.php;

        include /etc/nginx/snippets/fastcgi-php.conf;

    }

}
  1. Save and Exit (Press Ctrl + X, then Y, then Enter).

Restart Nginx to Apply Changes

After modifying the configuration, restart Nginx:

sudo systemctl restart nginx
Linux VDS
High performance for your projects
  • Root access and flexible setup
  • Control panel
  • NVMe disks
  • DDR5
Linux VDS

Alternative: Use Let's Encrypt for Free SSL

If your domain does not have SSL enabled, you can install a free Let's Encrypt SSL for phpMyAdmin:

  1. Install Let's Encrypt:
  2. sudo apt install certbot python3-certbot-nginx -y
  3. Generate SSL for phpMyAdmin subdomain:
  4. sudo certbot --nginx -d your-domain.com
  5. Verify SSL Installation:
  6. sudo ls /etc/letsencrypt/live/your-domain.com/
  7. Update Nginx Config with Let's Encrypt SSL:
  8. ssl_certificate /etc/letsencrypt/live/your-domain.com/fullchain.pem;
    
    ssl_certificate_key /etc/letsencrypt/live/your-domain.com/privkey.pem;
  9. Restart Nginx:
  10. sudo systemctl restart nginx

Secure phpMyAdmin Further

  1. Restrict Access by IP:
  2. location /phpmyadmin {
    
        allow 192.168.1.100;
    
        deny all;
    
    }
  3. Password Protect phpMyAdmin (Basic Authentication):
    • Create a password file:
    • sudo htpasswd -c /etc/phpmyadmin/.htpasswd admin
    • Modify the Nginx config:
  4. location /phpmyadmin {
    
        auth_basic "Restricted Access";
    
        auth_basic_user_file /etc/phpmyadmin/.htpasswd;
    
    }
  5. Disable Root Login for MySQL:
  6. UPDATE mysql.user SET plugin = 'unix_socket' WHERE User = 'root';
    
    FLUSH PRIVILEGES;

Verify SSL Access

  • Open phpMyAdmin via:
  • https://your-domain.com/phpmyadmin
  • Ensure the padlock icon appears, indicating a secure HTTPS connection.
  • Forces HTTPS for phpMyAdmin to prevent security risks.
  • Uses Let's Encrypt for free SSL if needed.
  • Secures phpMyAdmin with IP restrictions and authentication.
Frequently asked questions
Every database login crosses the network in plaintext, including the MySQL credentials. On a hotel/coffee-shop network or shared LAN, that's the highest-value password on the box being broadcast. HTTPS encrypts the credentials in flight — cheap to add, large effect on risk.
VestaCP's panel TLS is bound to port 8083; phpMyAdmin lives on the main Apache (port 80/443). Reusing the panel cert is theoretically possible but messy. Issue Let's Encrypt for the host or subdomain phpMyAdmin runs under — that's the maintained path.
Two configs are fighting — typically the vhost has RewriteRule . https://... and Apache also has a global redirect. Pick one place, remove the other. Verify with curl -IL http://server/phpmyadmin — exactly one 301 to https://server/phpmyadmin should appear.
If you can — yes. The smallest attack surface for a sensitive panel is one that's only reachable from a known network. VPN-only access combined with HTTPS is the strongest setup; HTTPS alone (with a strong password) is the practical fallback when VPN isn't an option.
Related articles
Accessing phpMyAdmin in Vesta Control Panel
Fixing ERR_INVALID_RESPONSE in PHP — System Administrator's Guide
Error: Type=AAAA Host Not Found — Troubleshooting Guide