We are happy to announce that Vesta is back under active development as of 25 February 2024. We are working on Vesta 2.0 and expect to release it soon. Read more about it: https://vestacp.com/docs/vesta-2-development
[ TUTORIAL ] How to change the default /phpmyadmin alias url
[ TUTORIAL ] How to change the default /phpmyadmin alias url
In this tutorial we will show you how to change the default location to access /phpmyadmin to something else more private.
Why would we do this, firstly it deters automated bots & also anyone who knows you may be using phpmyadmin on your server from finding the login page.
lets do this................
1) Connect to your server ROOT access (SSH)
2) Open the apache2.conf.
3) Find this line, should be at the top:
4) Change /phpmyadmin to anything!! for example we will use /private_phpmyadmin like this:
5) restart apache2, important!!
6) Let's go test it....
Type your old URL:
-- you should get a 404 error (page missing) Good!
Now Try the new private URL:
That's it, now only you and your private clients will know where the login page for phpmyadmin is located.
This change will not update the link in vestacp to the phpmyadmin link under websites, you will need to change the url destination in the theme also.
THEME/UI EDIT Link
As requested, here is the way to edit the new link in the theme
We need to do this in two areas, admin and user folders.
1) Connect to your server ROOT access (SSH)
2) Open Admin Folder
Find the line:
Change it to:
F2, Y, enter.
3) Open USER Folder
Find the line:
Change it to:
F2, Y, enter.
Test it, all good.
:)
Why would we do this, firstly it deters automated bots & also anyone who knows you may be using phpmyadmin on your server from finding the login page.
lets do this................
1) Connect to your server ROOT access (SSH)
2) Open the apache2.conf.
Code: Select all
nano /etc/phpmyadmin/apache2.conf
Code: Select all
Alias /phpmyadmin /usr/share/phpmyadmin
Code: Select all
Alias /private_phpmyadmin /usr/share/phpmyadmin
Code: Select all
/etc/init.d/apache2 restart
Type your old URL:
Code: Select all
http://change-to-your-server-ip-or-domain-setup/phpmyadmin
-- you should get a 404 error (page missing) Good!
Now Try the new private URL:
Code: Select all
http://change-to-your-server-ip-or-domain-setup/private_phpmyadmin
This change will not update the link in vestacp to the phpmyadmin link under websites, you will need to change the url destination in the theme also.
THEME/UI EDIT Link
As requested, here is the way to edit the new link in the theme
We need to do this in two areas, admin and user folders.
1) Connect to your server ROOT access (SSH)
2) Open Admin Folder
Code: Select all
nano /usr/local/vesta/web/templates/admin/list_db.html
Code: Select all
if ($data[$key]['TYPE'] == 'mysql') $db_admin_link = "http://".$http_host."/phpmyadmin/";
Code: Select all
if ($data[$key]['TYPE'] == 'mysql') $db_admin_link = "http://".$http_host."/private_phpmyadmin/";
3) Open USER Folder
Code: Select all
nano /usr/local/vesta/web/templates/user/list_db.html
Code: Select all
if ($data[$key]['TYPE'] == 'mysql') $db_admin_link = "http://".$http_host."/phpmyadmin/";
Code: Select all
if ($data[$key]['TYPE'] == 'mysql') $db_admin_link = "http://".$http_host."/private_phpmyadmin/";
Test it, all good.
:)
Last edited by jonn on Tue Jun 10, 2014 8:53 am, edited 1 time in total.
Re: [ TUTORIAL ] How to change the default /phpmyadmin alias
can you also post guide where we could edit the phpmyadmin link in the theme/UI ?
Re: [ TUTORIAL ] How to change the default /phpmyadmin alias
post updated.erldcrtz wrote:can you also post guide where we could edit the phpmyadmin link in the theme/UI ?
Re: [ TUTORIAL ] How to change the default /phpmyadmin alias
Hi, jonn
Thank you for your help
Thank you for your help
Re: [ TUTORIAL ] How to change the default /phpmyadmin alias
Hi Jonn,
on database creation there's a notification with link to phpmyadmin
how to change this link?
on database creation there's a notification with link to phpmyadmin
Code: Select all
Adding database → Database admin_test has been created successfully / open phpMyAdmin
Re: [ TUTORIAL ] How to change the default /phpmyadmin alias
Nice tutorial, thanks for that. One thing: I tried it today on Ubuntu 14.04 LTS. File named in step 2) is named apache.conf now, not apache2.conf.
But when I look at the config and log file locations named in VestaCP Docs (http://vestacp.com/docs/#config-log-loc ... ian-ubuntu) they are wrong most of the time to. So maybe it's an Ubuntu thing then? Or the docs aren't up to date.
But when I look at the config and log file locations named in VestaCP Docs (http://vestacp.com/docs/#config-log-loc ... ian-ubuntu) they are wrong most of the time to. So maybe it's an Ubuntu thing then? Or the docs aren't up to date.
Re: [ TUTORIAL ] How to change the default /phpmyadmin alias url
cannot find apache2.conf in centOS. Can anyone point me where is the setting file. Edited: I found the right one here etc/httpd/conf.d/phpMyAdmin.conf
Re: [ TUTORIAL ] How to change the default /phpmyadmin alias url
I've edited both template files but Vesta CP still links to phpmyadmin folder, any ideas?
Re: [ TUTORIAL ] How to change the default /phpmyadmin alias url
Late but might be useful for someone elseWAS wrote:I've edited both template files but Vesta CP still links to phpmyadmin folder, any ideas?
Code: Select all
$db_myadmin_link = "http://".$http_host."phpmyadmin/";
Re: [ TUTORIAL ] How to change the default /phpmyadmin alias url
Also, don't forget to update here:
sudo nano /usr/local/vesta/web/add/db/index.php
Look for:
if ($_POST['v_type'] == 'mysql') $db_admin_link = "http://".$http_host."/phpmyadmin/"
sudo nano /usr/local/vesta/web/add/db/index.php
Look for:
if ($_POST['v_type'] == 'mysql') $db_admin_link = "http://".$http_host."/phpmyadmin/"