Restrict Access Phpmyadmin Nginx/Apache/PHP-FPM

Before I moved to Nginx proxy for Apache and PHP-FPM and was running strictly with Apache, restricting access to phpmyadmin was as simple as adding a few require ip lines to /etc/phpmyadmin/apache.conf, but it appears that no longer works while running it through the proxy setup. Is there somewhere else I need to set this? I tried editing /etc/nginx/conf.d/phpmyadmin.inc as follows, bit it did not work and phpmyadmin was still accessible via the internet.

    location ~ ^/phpmyadmin/(.*\.php)$ {
        allow 192.168.1.0/24;
        deny all;
        alias /usr/share/phpmyadmin/$1;
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $request_filename;
    }

Modify /etc/apache2/conf.d/phpmyadmin.conf

1 Like

Lol, dang, I must not have searched hard enough. Thank you so much!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.