1,解压缩phpmyadmin4.2.8压缩包到/usr/local/phpMyAdmin
2,复制config.sample.inc.php为config.inc.php
3,修改nginx.conf 里
加入 include /usr/local/nginx/conf.d/*.conf; 这段,
http { include mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; gzip on; include /usr/local/nginx/conf.d/*.conf;
新建conf.d文件夹
新建phpmyadmin.conf如下
server { listen 8081; server_name localhost; access_log /usr/local/nginx/phpmyadmin-access.log main; location / { root /usr/local/phpMyAdmin; index index.php; } location ~ .php$ { root /usr/local/phpMyAdmin; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } location ~ /.ht { deny all; } }
4,config.inc.php修改为:
* This is needed for cookie based authentication to encrypt password in * cookie */ $cfg['blowfish_secret'] = '123456'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */ /* * Servers configuration */ $i = 0; /* * First server */ $i++; /* Authentication type */ $cfg['Servers'][$i]['auth_type'] = 'config'; /* Server parameters */ $cfg['Servers'][$i]['host'] = '127.0.0.1'; $cfg['Servers'][$i]['connect_type'] = 'tcp'; $cfg['Servers'][$i]['compress'] = false; $cfg['Servers'][$i]['AllowNoPassword'] = true; /* * phpMyAdmin configuration storage settings. */ /* User used to manipulate with storage */ // $cfg['Servers'][$i]['controlhost'] = ''; // $cfg['Servers'][$i]['controlport'] = ''; $cfg['Servers'][$i]['controluser'] = 'root'; $cfg['Servers'][$i]['controlpass'] = ''; /* Storage database and tables */ // $cfg['Servers'][$i]['pmadb'] = 'phpmyadmin'; // $cfg['Servers'][$i]['bookmarktable'] = 'pma__bookmark'; // $cfg['Servers'][$i]['relation'] = 'pma__relation'; // $cfg['Servers'][$i]['table_info'] = 'pma__table_info'; // $cfg['Servers'][$i]['table_coords'] = 'pma__table_coords'; // $cfg['Servers'][$i]['pdf_pages'] = 'pma__pdf_pages'; // $cfg['Servers'][$i]['column_info'] = 'pma__column_info'; // $cfg['Servers'][$i]['history'] = 'pma__history'; // $cfg['Servers'][$i]['table_uiprefs'] = 'pma__table_uiprefs'; // $cfg['Servers'][$i]['tracking'] = 'pma__tracking'; // $cfg['Servers'][$i]['designer_coords'] = 'pma__designer_coords'; // $cfg['Servers'][$i]['userconfig'] = 'pma__userconfig'; // $cfg['Servers'][$i]['recent'] = 'pma__recent'; // $cfg['Servers'][$i]['favorite'] = 'pma__favorite'; $cfg['Servers'][$i]['users'] = 'root'; $cfg['Servers'][$i]['password'] = ''; // $cfg['Servers'][$i]['usergroups'] = 'pma__usergroups'; // $cfg['Servers'][$i]['navigationhiding'] = 'pma__navigationhiding'; // $cfg['Servers'][$i]['savedsearches'] = 'pma__savedsearches'; /* Contrib / Swekey authentication */ // $cfg['Servers'][$i]['auth_swekey_config'] = '/etc/swekey-pma.conf';