The Complete Guide to Install Nginx on CentOS 7 with phpMyAdmin

Installation and Configuration of phpMyAdmin

  1. Install phpMyAdmin.
    sudo yum install phpmyadmin
  2. Create a symbolic link to your public_html folder. In some cases /usr/share/phpmyadmin is use.
    sudo ln -s /usr/share/phpMyAdmin /var/www/yourdomain.com/public_html
  3. If you encounter an error for accessing phpMyAdmin, follow the instructions below.
    1. Add a session folder.
      mkdir -p /var/lib/php/session
    2. Configure config.inc.php permission/access.
      sudo chmod 755 -R /usr/share/phpmyadmin/config.inc.php
    3. Find this line:
      $cfg['blowfish_secret'] = ; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
    4. Add a blowfish password on it with any random characters and/or numbers being unique to your instance for phpMyAdmin. Maximum string length is 48.
      $cfg['blowfish_secret'] = 'yourblowfishpassword'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
    5. If you encounter an mbstring error, install php-mysql, php-mbstring, php-mcrypt and php-gd:
      sudo systemctl restart php-fpm
      sudo yum -y install php-mysql
      sudo yum -y install php-mbstring php-mcrypt php-gd
      sudo systemctl restart php-fpm
  4. Change session.inc.php user permission access for public.
    sudo chown nginx:nginx /usr/share/phpmyadmin/libraries/session.inc.php -R
    sudo chmod 755 /usr/share/phpmyadmin/libraries/session.inc.php -R
  5. To adjust maximum upload SQL size, browse nginx.conf and add max body size inside http.
    sudo nano /etc/nginx/nginx.conf
    # set client body size to 2M
    client_max_body_size 2M;
    
  6. Secure phpMyAdmin using the instructions below.
      1. Rename your phpMyAdmin shortcut (symbolic link).
        sudo mv phpMyAdmin yournewphpmyadminname
      2. Generate SSL password using Linux, then save the password to use it on the next step.
        openssl passwd
      3. Change Admin password.
        sudo nano /etc/nginx/pma_pass
        Admin:Yourgeneratedpassword
      4. Browse your site configuration file from sites-available.
        sudo nano /etc/nginx/sites-available/yourdomain.com.conf

    Add these data inside your server { } block.

    location /yournewphpmyadminname {
        auth_basic "Admin Login";
        auth_basic_user_file /etc/nginx/pma_pass;
    }
    

You are now done and ready to use your server. You can install WordPress on it and add your database using phpMyAdmin.

Probewise

I create WordPress themes and plugins with simplicity for all people. I am also a blogger, layout artist and a computer technician.

Join the Discussion

Your email address will not be published.

Back to top