phpMyAdmin Alias Not Working

Hi,
I wanted to restrict access to phpMyAdmin in HestiaCP.
І also changed the phpMyAdmin alias in Server → Settings → Configure → Databases → phpMyAdmin Alias.

Now /phpmyadmin/ is blocked as expected, but the new alias I set in the panel also doesn’t work - it returns 404 or just doesn’t load at all.

I am on Nginx standalone (no Apache).

Is there anything else I need to edit so the new alias works?

Hi @Konstantinus

Does the new alias appear on this conf file?

cat /etc/nginx/conf.d/phpmyadmin.inc

Does the include directive pointing to phpmyadmin.inc appear in your web domain config? (Replace YourDomain with the actual domain name)

grep phpmyadmin /etc/nginx/conf.d/domains/YourDomain.conf
grep phpmyadmin /etc/nginx/conf.d/domains/YourDomain.ssl.conf

Hi @sahsanu, thanks for jumping in!

  1. Current /etc/nginx/conf.d/phpmyadmin.inc:
    location /mysqladmin {
    <------>alias /usr/share/phpmyadmin/;

<------>location ~ /(libraries|setup|templates|locale) {
<------><------>deny all;
<------><------>return 404;
<------>}

<------>location ~ /(.+.(json|lock|md)) {
<------><------>deny all;
<------><------>return 404;
<------>}

<------>location ~ ^/newalias/(.*.php)$ {
<------><------>alias /usr/share/phpmyadmin/$1;
<------><------>include /etc/nginx/fastcgi_params;
<------><------>fastcgi_index index.php;
<------><------>fastcgi_param HTTP_EARLY_DATA $rfc_early_data if_not_empty;
<------><------>fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
<------><------>fastcgi_pass unix:/run/php/www.sock;
<------>}

<------>location /newalias/(.+.(jpg|jpeg|gif|css|png|webp|js|ico|html|xml|txt))$ {
<------><------>root /usr/share/phpmyadmin/;
<------>}
}

  1. Domain configs include the phpmyadmin file:

root@web:/home/archive# grep phpmyadmin /etc/nginx/conf.d/domains/DOMAIN.conf
include /etc/nginx/conf.d/phpmyadmin.inc*;

root@web:/home/archive# grep phpmyadmin /etc/nginx/conf.d/domains/DOMAIN.ssl.conf
include /etc/nginx/conf.d/phpmyadmin.inc*;

URL https://domain/newalias/ still doesn’t work — the browser shows Error Code: 500.

I assume you haven’t manually modified phpmyadmin.inc.

The alias is different in the output you showed (mysqladmin vs newalias). I don’t know whether you forgot to replace it to hide the actual alias or if it’s really a misconfiguration.

What does the error log say? The error log should be here: /var/log/nginx/error.log or /var/log/nginx/domains/YourDomain.error.log.

I’m leaving now, so I won’t be able to answer until this evening.

1 Like

Thanks for the follow-up.

And yes - I tried to hide the real alias in my previous message, but didn’t do it very well :slightly_smiling_face:

I checked /var/log/nginx/domains/***.error.log and found this entry:
025/08/10 11:57:38 [crit] 2625#2625: *1 connect() to unix:/run/php/www.sock failed (2: No such file or directory) while connecting to upstream, client: 192.168.10.21, server: xxxxx, request: “GET /mysqladmin/ HTTP/2.0”, upstream: “fastcgi://unix:/run/php/www.sock:”, host: “xxxxx”

Show the output of these commands:

grep -r www.sock /etc/php/
php -v | head -n1

root@web:/home/archive# grep -r www.sock /etc/php/
root@web:/home/archive# php -v | head -n1
PHP 8.3.24 (cli) (built: Aug 3 2025 08:58:02) (NTS)
root@web:/home/archive#

That’s pretty strange.

Run this command and try again (it may take a few minutes):

v-change-sys-php 8.3

Thanks, there’s some progress now. I can reach the /mysqladmin/ URL, but now I get this error in the browser:

Show the output of this command:

ls -la /etc/phpmyadmin/

root@web:/home/archive# ls -la /etc/phpmyadmin/
total 16
drwxr-xr-x 3 root www-data 54 Oct 13 2024 .
drwxr-xr-x 137 root root 8192 Aug 10 11:52 ..
drwxr-x— 2 root www-data 38 Oct 13 2024 conf.d
-rw-r----- 1 root www-data 980 Oct 13 2024 config.inc.php
root@web:/home/archive#

Run these commands and try again:

chown -R root:hestiamail /etc/phpmyadmin/
chown hestiamail:www-data /usr/share/phpmyadmin/tmp

Did you install/reinstall phpmyadmin manually?

dpkg -l | grep phpmyadmin
1 Like

Thank you, everything works now!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.