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
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 aliasmysqladmin
will forward to thephpmyadmin
.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: