How to setup PHPMyAdmin as SubDomain on Apache 2.4.7?

13,003

Follow these steps. I'm going to use 'example' as the file/subdomain name. You can name it something like 'phpmyadmin'

sudo nano /etc/apache2/sites-available/example.conf

Add this inside example.conf

<VirtualHost *:80>

    ServerAdmin [email protected]
    ServerName domain.com
    ServerAlias example.domain.com
    DocumentRoot /usr/share/phpmyadmin

        <Directory /usr/share/phpmyadmin>
            Require all granted
        </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

Save the file and then from your terminal run

sudo a2ensite example.conf

Now just restart apache2

sudo service apache2 reload

That's all you have to do for it to work in Ubuntu 14.04 with Apache 2.4.7 and to get to your PHPMyAdmin just type this in your browser.

http://example.domain.com
Share:
13,003

Related videos on Youtube

user2841270
Author by

user2841270

Updated on September 18, 2022

Comments

  • user2841270
    user2841270 over 1 year

    I'm currently having issues setting up PHPMyAdmin as a subdomain. I was able to do this on Ubuntu 12.04 no problem but since upgrading can't seem to get it properly configured. Here's the conf I'm trying to load:

        <VirtualHost *:80>
        ServerName sub.domain.com
        ServerAlias www.sub.domain.com
        DocumentRoot "/usr/share/phpmyadmin"
        <Directory /usr/share/phpmyadmin>
        Options FollowSymLinks
        DirectoryIndex index.php
        <IfModule mod_php5.c>
        AddType application/x-httpd-php .php
        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/$
        </IfModule>
        </Directory>
        <Directory /usr/share/phpmyadmin/libraries>
        # AllowOverride All
        # Require all granted
        Order Deny,Allow
        Deny from All
        </Directory>
        <Directory /usr/share/phpmyadmin/setup/lib>
        # AllowOverride All
        # Require all granted
        Order Deny,Allow
        Deny from All
        </Directory>
        </VirtualHost>
    
    • Lety
      Lety over 9 years
      Could you update your question with error you got?
  • pixeline
    pixeline over 9 years
    you are missing the closing </VirtualHost>