[ TUTORIAL ] How to change the default /phpmyadmin alias url Topic is solved

Questions regarding the Web Server
Apache + Nginx, Nginx + PHP5-FPM
jonn
Posts: 72
Joined: Sun Jun 08, 2014 12:18 pm

[ TUTORIAL ] How to change the default /phpmyadmin alias url  Topic is solved

Postby jonn » 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.

Code: Select all

nano /etc/phpmyadmin/apache2.conf


3) Find this line, should be at the top:

Code: Select all

Alias /phpmyadmin /usr/share/phpmyadmin


4) Change /phpmyadmin to anything!! for example we will use /private_phpmyadmin like this:

Code: Select all

Alias /private_phpmyadmin /usr/share/phpmyadmin


5) restart apache2, important!!

Code: Select all

/etc/init.d/apache2 restart


6) Let's go test it....
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


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

Code: Select all

nano /usr/local/vesta/web/templates/admin/list_db.html

Find the line:

Code: Select all

if ($data[$key]['TYPE'] == 'mysql') $db_admin_link = "http://".$http_host."/phpmyadmin/";


Change it to:

Code: Select all

if ($data[$key]['TYPE'] == 'mysql') $db_admin_link = "http://".$http_host."/private_phpmyadmin/";


F2, Y, enter.

3) Open USER Folder

Code: Select all

nano /usr/local/vesta/web/templates/user/list_db.html


Find the line:

Code: Select all

if ($data[$key]['TYPE'] == 'mysql') $db_admin_link = "http://".$http_host."/phpmyadmin/";


Change it to:

Code: Select all

if ($data[$key]['TYPE'] == 'mysql') $db_admin_link = "http://".$http_host."/private_phpmyadmin/";


F2, Y, enter.

Test it, all good.

:)
Last edited by jonn on Tue Jun 10, 2014 8:53 am, edited 1 time in total.

erldcrtz
Posts: 73
Joined: Tue Jun 10, 2014 6:16 am

Re: [ TUTORIAL ] How to change the default /phpmyadmin alias

Postby erldcrtz » Tue Jun 10, 2014 6:17 am

can you also post guide where we could edit the phpmyadmin link in the theme/UI ?

jonn
Posts: 72
Joined: Sun Jun 08, 2014 12:18 pm

Re: [ TUTORIAL ] How to change the default /phpmyadmin alias

Postby jonn » Tue Jun 10, 2014 8:53 am

erldcrtz wrote:can you also post guide where we could edit the phpmyadmin link in the theme/UI ?


post updated.

imperio
VestaCP Team
Posts: 5461
Joined: Sat Dec 01, 2012 12:37 pm
Contact:

Re: [ TUTORIAL ] How to change the default /phpmyadmin alias

Postby imperio » Tue Jun 24, 2014 3:55 pm

Hi, jonn
Thank you for your help
-> DigitalOcean competition - please, support us
-> fix for phpmyadmin - nice and sweet now

purwa
Posts: 3
Joined: Wed Jun 18, 2014 6:18 am

Re: [ TUTORIAL ] How to change the default /phpmyadmin alias

Postby purwa » Thu Jun 26, 2014 11:37 am

Hi Jonn,
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

how to change this link?

Tralapo
Posts: 23
Joined: Wed Oct 15, 2014 11:25 am

Re: [ TUTORIAL ] How to change the default /phpmyadmin alias

Postby Tralapo » Fri Dec 12, 2014 4:55 pm

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.

arafatx
Posts: 23
Joined: Tue Aug 11, 2015 4:51 pm

Re: [ TUTORIAL ] How to change the default /phpmyadmin alias url

Postby arafatx » Tue Jan 05, 2016 11:03 pm

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

WAS
Posts: 10
Joined: Thu Feb 12, 2015 7:55 pm

Re: [ TUTORIAL ] How to change the default /phpmyadmin alias url

Postby WAS » Sat Mar 26, 2016 5:06 am

I've edited both template files but Vesta CP still links to phpmyadmin folder, any ideas?

Naldinho
Posts: 31
Joined: Sat Nov 05, 2016 12:54 am

Re: [ TUTORIAL ] How to change the default /phpmyadmin alias url

Postby Naldinho » Fri Nov 11, 2016 8:20 pm

WAS wrote:I've edited both template files but Vesta CP still links to phpmyadmin folder, any ideas?


Late but might be useful for someone else

Code: Select all

$db_myadmin_link = "http://".$http_host."phpmyadmin/";


needs changing on both files.

blueberry
Posts: 22
Joined: Tue May 02, 2017 9:35 am

Re: [ TUTORIAL ] How to change the default /phpmyadmin alias url

Postby blueberry » Sun May 14, 2017 5:31 am

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/"


Return to “Web Server”



Who is online

Users browsing this forum: No registered users and 3 guests

cron