1

The way Webmin seems to install phpMyAdmin is to install it inside the public_html directory. e.g.

https://mydomain.com/phpMyAdmin

I don't want to debate the vulnerability, instead I want phpMyAdmin to function on Webmin like it does in cPanel.

One recommendation was to create a subdomain and install it there, but this is an extra step every time.

cPanel doesn't have phpMyAdmin even accessible by the domain. Instead, it is located like this:

https://server1.myserver.com:2083/cpsess9292847592/3rdparty/phpMyAdmin/index.php

And it's only accessible through the web control panel. It seems to add a session ID to the URL too so it's only even valid for the current login, and then the URL doesn't exist if the user logs out or the session isn't valid.

Even better, this is also accessible by admins through WHM in one central place.

How can I get phpMyAdmin to install automatically for every use like it does in cPanel, and to install in a non-public directory that uses the server hostname like cPanel does?

1 Answer 1

0

To clarify, if you want to access phpMyAdmin using the URL http://yourdomain/phpmyadmin while keeping the main website files in /home/dark/public_html and phpMyAdmin files in /var/www/html, you can use a separate server block for phpMyAdmin.

server {
    listen 80;
    listen [::]:80;
    server_name yourdomain.com;
    root /home/username/public_html;
    index index.php index.html;

    location / {
        try_files $uri $uri/ =404;
    }
}

server {
    listen 80;
    listen [::]:80;
    server_name yourdomain.com;

    location /phpmyadmin {
        root /var/www/html;
        index index.php;
        location ~ \.php$ {
            include snippets/fastcgi-php.conf;
            fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
        }
    }
}


The first server block handles the main website files located in /home/dark/public_html.

The second server block handles requests to /phpmyadmin and sets the root directory to /var/www/html. Additionally, it includes a location ~ .php$ block to handle PHP files and pass them to the PHP FastCGI server for processing. Make sure to adjust the fastcgi_pass directive to match the correct PHP-FPM socket path for your system.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.