Changing the phpMyAdmin access URL
Note
This post may be partially machine- or AI-translated. If there is any discrepancy, the Korean version takes precedence.
Note
This post might be outdated and some links might not be available.
I saw many failed phpMyAdmin login attempts in the Apache logs, so I considered a few countermeasures.
- Install Fail2ban
- Allow access only from specific IP addresses
- Use
.htpasswd - Change the access URL
Changing the access URL uses few server resources and is still convenient when I need to connect later, so I chose that approach.
Create the URL to use
Generate a random string.
RANDOM.ORG
Random String Generator
I generated it with the following conditions:
- 1 string
- 20 characters long
- Numbers + uppercase letters + lowercase letters
- Duplicate characters allowed
Generated stringjKGL3u4o2YJLxh1hfTbB
Apache configuration
Change phpMyAdmin’s Apache configuration.
# nano /etc/apache2/conf-enabled/phpmyadmin.conf
In phpmyadmin.conf, changeAlias /phpmyadmin /usr/share/phpmyadmin to#Alias /phpmyadmin /usr/share/phpmyadmin to comment it out.
This means URL /phpmyadmin serves files from /usr/share/phpmyadmin.
Using the string generated above, add the following line below the commented line:Alias /jKGL3u4o2YJLxh1hfTbB /usr/share/phpmyadmin
Press Ctrl+X -> Y -> Enter to save.
Check whether the configuration is valid.# apachectl configtest
If Syntax OK is printed, there is no problem.
Restart Apache with # apachectl restart.
Open /jKGL3u4o2YJLxh1hfTbB in a web browser.