Hey everyone. Firstly, I’ve just moved to DigitalOcean from a shared hosting account with another company, so I’m still getting the hang of configuring my server appropriately - so apologies if I’m slow to understand something.
Currently I have phpmyadmin configured and secured on my LAMP stack in Ubuntu, and I can navigate to it in my browser by entering <My IP>/phpmyadmin/
What I’d like to do is emulate how my previous hosting setup managed phpmyadmin. I’d like to access it by heading to the address mysql.<mysitename>.com. I have already set up the A record for my site, but now I need to know how to create a subdomain and have phpmyadmin open on that. How can I accomplish this?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
First, disable the phpMyAdmin configuration file that maps /phpmyadmin to /usr/share/phpmyadmin:
sudo a2disconf phpmyadmin
Then, create a new virtual host (/etc/apache2/sites-available/mysql.sitename.com.conf) with the following content:
<VirtualHost *:80>
ServerAdmin admin@example.com
ServerName mysql.sitename.com
DocumentRoot /usr/share/phpmyadmin
<Directory /usr/share/phpmyadmin>
Options FollowSymLinks
DirectoryIndex index.php
<IfModule mod_php5.c>
<IfModule mod_mime.c>
AddType application/x-httpd-php .php
</IfModule>
<FilesMatch ".+\.php$">
SetHandler application/x-httpd-php
</FilesMatch>
php_flag magic_quotes_gpc Off
php_flag track_vars On
php_flag register_globals Off
php_admin_flag allow_url_fopen Off
php_value include_path .
php_admin_value upload_tmp_dir /var/lib/phpmyadmin/tmp
php_admin_value open_basedir /usr/share/phpmyadmin/:/etc/phpmyadmin/:/var/lib/phpmyadmin/:/usr/share/php/php-gettext/:/usr/share/javascript/:/usr/share/php/tcpdf/
</IfModule>
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Finally, restart Apache:
sudo service apache2 restart
You should then be able to access phpmyadmin through mysql.sitename.com.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.