secure phpmyadmin nginx

 [root@localhost conf.d]# pwd

/etc/nginx/conf.d

[root@localhost conf.d]# ls

phpmyadmin.inc  phppgadmin.inc  status.conf  vesta.conf  webmail.inc

[root@localhost conf.d]# cat phpmyadmin.inc 

location /phpmyadmin {

    alias /usr/share/phpMyAdmin;

allow 192.0.2.142;

    allow 192.168.1.0/24;

    deny all;

    location ~ /(libraries|setup) {

        return 404;

    }


    location ~ ^/phpmyadmin/(.*\.php)$ {

        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;

    }

    location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {

        alias /usr/share/phpMyAdmin/$1;

    }

}


    1. Nginx

      1. Connect to the server with ISPmanager via SSH.
      2. Open the phpMyAdmin configuration file /etc/nginx/vhosts-includes/phpmyadmin.conf.
      3. Add the following strings to the location /phpmyadmin section

        allow <permitted IP address or subnet>;
        deny all;
        CODE

        Note

        For the authentication settings to work correctly, add the IP address of the control panel to the list of permitted IP addresses.


location /phpmyadmin {
alias /usr/share/phpMyAdmin;
index index.php;
allow 192.0.2.142;
    allow 192.168.1.0/24;
    deny all;
}

Comments

Popular posts from this blog

cpanel exam CPSP Answers

How to install zimbra collaboration suite 8.8.11 on CentOS 7

awstats installation