[ TUTORIAL ] How to change the default /phpmyadmin alias url
Posted: Sun Jun 08, 2014 1:36 pm
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.
:)