1

To increase security in my server I created an subdomain only for admin, like admin.domain.tld and usually i access phpmyadmin by going only at admin.domain.tld/mysqladmin as in config file:

<VirtualHost *:80>

    ServerName admin.domain.tld
    Alias /mysqladmin /usr/share/phpMyAdmin/

    <Directory /usr/share/phpMyAdmin/>
        AddDefaultCharset UTF-8
        AllowOverride All

    [...]

</VirtualHost>

now that I have have a subdomain i want to SSL secure it, for that i need to configure a virtual host or something like, (i use certbot aka let's encrypt), but as i have to configure a virtual host i decided to create a admin only html page in admin.domain.tld containing links to my admin pages like phpmyadmin, joomla admin page, etc...

config file:

    ServerName  admin.domain.tld

    DocumentRoot /var/www/admin.domain.tld
    ErrorLog /var/log/httpd/admin.domain.tld/error.log
    <Directory /var/www/admin.domain.tld>
            Options FollowSymLinks Indexes
            AllowOverride All
    </Directory>

but now when i go to admin.domain.tld/mysqladmin i get an error:

The requested URL /mysqladmin/ was not found on this server.

So, how can i get it working like this:

admin.domain.tld is /var/www/admin.domain.tld
and
admin.domain.tld/mysqladmin is phpmyadmin

EDIT: i guess my problem is the alias is not working so when i go to admin.domain.tld it shows /var/www/admin.domain.tld/mysqladmin instead of /usr/share/phpMyAdmin

  • Did you put the alias in? You've only shown it here for the non-https virtual host. – yoonix May 24 '16 at 22:53
  • @yoonix i didn't secured it with ssl yet... – DiogoSaraiva May 24 '16 at 22:55
1

You are doing a loop in the first config. You send the alias to the same root directory, so when call the alias, will display the same root directory. In that case, you will need a mysqladmin folder on /usr/share/phpMyAdmin/.

Try to use /var/www/admin.domain.tld to root directory in both config files, so the alias mysqladmin will forward to the phpmyadmin.

  • my problem is the alias is not working so when i go to admin.domain.tld it shows /var/www/admin.domain.tld/mysqladmin instead of /usr/share/phpMyAdmin – DiogoSaraiva May 24 '16 at 23:37
0

I managed to solve my problem by putting the content of phpmyadmin virtual host together with the one of the admin.domain.tld. like this:

<VirtualHost *:80>
    ServerName  admin.domain.tld
    DocumentRoot /var/www/admin.domain.tld
    ErrorLog /var/log/httpd/admin.domain.tld/error.log
    <Directory /var/www/admin.domain.tld>
        Options FollowSymLinks Indexes
        AllowOverride All
    </Directory>
    Alias /mysqladmin /usr/share/phpMyAdmin
    <Directory /usr/share/phpMyAdmin/>
        AddDefaultCharset UTF-8
        AllowOverride All

     [...]

</VirtualHost>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.