change phpmyadmin url

Hey @jp001,

We can help you with this if you open a ticket with our support department. This is, however, fairly simple.

The best way to add custom configurations for things like apache, (in this case, aliases for apache) is via the 'custom' build configurations in /usr/local/directadmin/custombuild/custom/. You may need to create this folder, though, since it's not there by default. All of your templates for custom configurations can be found in /usr/local/directadmin/custombuild/configure/.

In your case, given the above, you can do:
Code:
mkdir -p /usr/local/directadmin/custombuild/custom/ap2/conf/extra
cp -fp /usr/local/directadmin/custombuild/configure/ap2/conf/extra/httpd-alias.conf /usr/local/directadmin/custombuild/custom/ap2/conf/extra

Then, with your favorite editor, modify the aliases to your content. In this case, I removed the Aliases for all of the phpmyadmin links, and kept a single /pma3 there:

Code:
[root@test-server custombuild]# cat /usr/local/directadmin/custombuild/custom/ap2/conf/extra/httpd-alias.conf
Alias /config "/var/www/html/redirect.php"
Alias /pma3 "/var/www/html/phpMyAdmin/"
Alias /squirrelmail "/var/www/html/squirrelmail/"
Alias /roundcube "/var/www/html/roundcube/"
Alias /webmail "/var/www/html/roundcube/"
Alias /.well-known/acme-challenge "/var/www/html/.well-known/acme-challenge/"

Once you're done making your modifications, you'll simply need to rewrite the configuration files, like so:

Code:
cd /usr/local/directadmin/custombuild
./build rewrite_confs

After that, your new alias should work, instead of the old ones.
 
Thanks so much for the detailed, yet easy-to-follow instructions! I wonder though, is there a chance this could "break" months down the line due to an apache or directadmin update? If so, could you post instructions on how to revert this. (just delete the newly created directory?)


(I would also like the option to restrict access by IP, but will post it as a separate thread/topic.)
 
Hey @jp001

Simply removing the file located in the custom directory tree (httpd-alias.conf) would do the trick.


(I would also like the option to restrict access by IP, but will post it as a separate thread/topic.)

It would better (read, easier) to restrict phpmyadmin to logged in users. You can do that by doing the following:
Code:
cd /usr/local/directadmin/custombuild
./build update
./build set phpmyadmin_public no
./build phpmyadmin
 
Hey @jp001
It would better (read, easier) to restrict phpmyadmin to logged in users. You can do that by doing the following:
Code:
cd /usr/local/directadmin/custombuild
./build update
./build set phpmyadmin_public no
./build phpmyadmin

I have tried this, but get the following message: "Access to phpMyAdmin is only allowed from control panel."
I try to access via the control panel in DirectAdmin and get the same message. I'm not sure what I'm missing here...
 
Did you update the phpmyadmin URL?

If you did, you'll need to change the build "phpmyadmin_public" option back to yes, since the evolution theme doesn't update with the new name (the link is broken). If you want to keep it this way, you'll need to modify the skin as well, which is a bit frustrating to do.

Are you actually logged in as the user when trying to login to phpmyadmin? Or are you the admin 'logged in as'?
 
No. I tried the the "phpmyadmin_public" option before posting here, but I didn't appreciate how the url is still obvious. (Have not updated the url yet)

Are you actually logged in as the user when trying to login to phpmyadmin? Or are you the admin 'logged in as'?

I do receive the message when logged in as user. I get the impression from the DA admin in the following thread that the we need to activate auto-login? (see links below) But looks like more than I wish to tackle right now.

 
Last edited:
I do receive the message when logged in as user. I get the impression from the DA admin in the following thread that the we need to activate auto-login? (see links below) But looks like more than I wish to tackle right now.
I've been playing with this for a bit this morning.

The phpMyAdmin link within DirectAdmin's User Level doesn't actually work to allow one-click-logins. I haven't found any resources yet to indicate that it ever has been setup in that manner.

We do have a resource link on enabling one-click-logins for PMA, but they're through the MySQL Management link. You can read about it here: https://www.knownhost.com/wiki/control-panels/directadmin/how-to-enable-auto-login

You can still allow a public-facing PMA login page and restrict via IP, if you wanted as well, with some .htaccess magic.

Navigate to /var/www/html/phpMyAdmin/ and create ".htaccess" - pico, nano, or vim all work here of course. And insert the following:
Code:
<Limit GET POST PUT>
    Order deny,allow
    Deny from all
    Allow from 111.111.11.1
    Allow from 111.1.22.1
</Limit>

Of course, make sure your IP is in the above block. If your IP doesn't match, you should see a 403 Forbidden message when trying to login.
 
You can still allow a public-facing PMA login page and restrict via IP, if you wanted as well, with some .htaccess magic.

Thanks! This was easy to implement and will likely serve my needs just fine! However, would it be safe to use this .htaccess method in combination with changing the phpmyadmin url/alias as you described at the top of the thread?
 
Update: It appears the .htaccess file gets deleted with DirectAdmin updates. Any ideas how to keep this file in place?

Thanks
 
Hey @jp001

That is correct; a lot of the customization for DirectAdmin must be handled in /usr/local/directadmin/custombuild/custom - most of these files can be found in /usr/local/directadmin/custombuild/configure. The link you provided will be very helpful for anyone else who stumbles upon this.
 
Top