Vesta Control Panel - Forum

Community Forum

Skip to content

Advanced search
  • Quick links
    • Main site
    • Github repo
    • Google Search
  • FAQ
  • Login
  • Register
  • Board index Main Section Web Server
  • Search

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

Questions regarding the Web Server
Apache + Nginx, Nginx + PHP5-FPM
Post Reply
  • Print view
Advanced search
12 posts
  • 1
  • 2
  • Next
jonn
Posts: 72
Joined: Sun Jun 08, 2014 12:18 pm

[ TUTORIAL ] How to change the default /phpmyadmin alias url
  • Quote

Post by 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.
Top

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

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

Post by erldcrtz » Tue Jun 10, 2014 6:17 am

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

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

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

Post by 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.
Top

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

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

Post by imperio » Tue Jun 24, 2014 3:55 pm

Hi, jonn
Thank you for your help
Top

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

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

Post by 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?
Top

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

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

Post by 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.
Top

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

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

Post by 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
Top

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

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

Post by WAS » Sat Mar 26, 2016 5:06 am

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

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

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

Post by 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.
Top

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

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

Post by 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/"
Top


Post Reply
  • Print view

12 posts
  • 1
  • 2
  • Next

Return to “Web Server”



  • Board index
  • All times are UTC
  • Delete all board cookies
  • The team
Powered by phpBB® Forum Software © phpBB Limited
*Original Author: Brad Veryard
*Updated to 3.2 by MannixMD
 

 

Login  •  Register

I forgot my password