Install and configure phpMyAdmin in nginx

Source: Internet
Author: User
Tags php and mysql database phpmyadmin

PhpMyAdmin is a common tool used to manage MySQL databases through the Web interface. It describes the installation method and how to configure Nginx in the form of subdirectories in Nginx.

Environment

System: CentOS
PHP: 5.6
PhpMyAdmin version: 4.6.2
PhpMyAdmin installation directory:/usr/share
PhpMyAdmin Access Directory: http: // YourDomin/phpMyAdmin/

1) Download phpMyAdmin

Download Address: https://www.phpmyadmin.net/downloads/

PhpMyAdmin 4.6.2 is the latest version in May June 20, 2016. You must download phpMyAdmin 4.0.10.15 or phpMyAdmin 4.4.15.6 before php5.3. php5.5 or above is the latest version.

# Cd/usr/share
# Wget https://files.phpmyadmin.net/phpMyAdmin/4.6.2/phpMyAdmin-4.6.2-all-languages.tar.xz
# Tar xvf phpMyAdmin-4.6.2-all-languages.tar.xz
# PhpMyAdmin mv phpMyAdmin-4.6.2-all-languages

2) Configure Nginx

Create the/etc/nginx/phpmyadmin file and enter the following content.

# Cat <EOF>/etc/nginx/phpmyadmin
Location/phpMyAdmin {
Alias/usr/share/phpMyAdmin;
Index. php;

Location ~ ^/PhpMyAdmin/. + \. php $ {
Alias/usr/share/phpMyAdmin;
Fastcgi_pass phpfpm;
Fastcgi_index index. php;
Fastcgi_param SCRIPT_FILENAME/usr/share $ fastcgi_script_name;
Include fastcgi_params;
    }
}
EOF

Note that the phpfpm part of fastcgi_pass phpfpm; must be changed to the path where Nginx and PHP-FPM can communicate.

Then add include/etc/nginx/conf. d/default. conf to/etc/nginx/phpmyadmin; to confirm the correctness of the Nginx configuration file and re-read the configuration file.

# Nginx-t
# Service nginx reload

Open the browser and enter http: // YourDomain/phpMyAdmin/to access phpMyAdmin.

3) configure config. inc. php

# Cd/usr/share/phpMyAdmin
# Cp-p config. sample. inc. php config. inc. php
 
Modify the following two parameters:

$ Cfg ['blowfish _ secret']
$ Cfg ['servers'] [$ I] ['host']
$ Cfg ['blowfish _ secret'] = ''; # default

$ Cfg ['blowfish _ secret'] = 'zabbix. Cc'; # enter any text

$ Cfg ['servers'] [$ I] ['host'] = 'localhost'; # The default value is localhost.

$ Cfg ['servers'] [$ I] ['host'] = '8. 8.8.8 '; # enter the host name or IP address of the MySQL database.

Modify the preceding two parameters in config. inc. php and save the file.

4) advanced phpMyAdmin functions

After logging on to phpMyAdmin, the following information is displayed.

Advanced phpMyAdmin functions are not fully set, and some functions are not activated. Click here to view the reason.
This is when you need to permanently save the information after phpMyAdmin is configured.

To create a database, run the following command.

# Mysql-uroot-p </usr/share/phpMyAdmin/SQL/create_tables. SQL

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.