How to change port access phpMyAdmin on Ubuntu 14.04/Apache?

October 29, 2014 35.1k views

Hi everyone,
I have a problem. I install phpmyadmin and I can access it from
Althought it’s OK, I want to access it from other port, like
How should I do? Help me! Thanks a lot!

2 Answers

phpMyAdmin is a web application, not a daemon. You will have to make your webserver listen on that port and then edit your vhosts so only that port has access to phpMyAdmin.

  • Thank Woet,
    I just tried to edit vhost and I can access phpmyadmin from port 9999. But I can also access it from port 80 and I don’t want it. Can I disable it?

  • Yes, depending on how you installed phpMyAdmin. If you use the package on ubuntu/debian, just edit /etc/apache2/conf.d/phpmyadmin.conf accordingly.

  • I going to try. Thank a lots! ^^

1.remove symlink to phpmyadmin.conf file

rm /etc/apache2/conf.d/phpmyadmin.conf
  1. make apache listen on port 81

sudo nano /etc/apache2/ports.conf

  NameVirtualHost *:80
  Listen 80
  Listen 81
 <IfModule mod_ssl.c>
       # SSL name based virtual hosts are not yet supported, therefore no
       # NameVirtualHost statement here
        Listen 443

3.Now create the vHost:

        sudo vi /etc/apache2/sites-available/phpmyadmin

              <VirtualHost *:81>
               ServerName phpmyadmin
               DocumentRoot /var/www-81

4.Enable the vHost

    sudo a2ensite phpmyadmin

5.restart the Apache

     sudo service apache2 restart
  1. Create a symlink to the phpmyadmin directoy:
    cd /var/www-81

        sudo ln -s /usr/share/phpmyadmin/
Have another answer? Share your knowledge.