Lab 4.4 Cài đặt mysqlAdmin với Nginx

  • Thread starter Thread starter root
  • Ngày gửi Ngày gửi

root

Specialist
1.Cài đặt phpmyadmin
- Các bạn xem lại bài cài đặt phpmyadmin lab4.2 http://svuit.com/showthread.php?387-Lab-4-2-Cài-đặt-phpmyadmin-trên-Centos-6-5-Minimal

[TABLE="class: outer_border, width: 700"]
[TR]
[TD][root@svuit html]# wget ftp://rpmfind.net/linux/epel/6/x86_6...6-8.noarch.rpm
[root@svuit html]# rpm -ivh epel-release-6-8.noarch.rpm
[root@svuit html]# rpm -Uvh http://rpms.famillecollet.com/enterp...-release-6.rpm
[root@svuit html]# yum --enablerepo=remi install phpMyAdmin[/TD]
[/TR]
[/TABLE]


cấu hình phpmyadmin, vào thư mục chứa phpMyAdmin copy file cấu hình
[TABLE="class: outer_border, width: 500"]
[TR]
[TD][root@svuit html]#cd /usr/share/phpMyAdmin/

[root@svuit phpMyAdmin]#cp config.sample.inc.php config.inc.php[/TD]
[/TR]
[/TABLE]

- Chỉnh sửa dòng màu đỏ trong file cấu hình của phpmyadmin
[root@svuit html]# vi /usr/share/phpMyAdmin/config.inc.php

28 /* Authentication type */
29 $cfg['Servers'][$i]['auth_type'] = 'http';
30 /* Server parameters */
31 $cfg['Servers'][$i]['host'] = 'any';
32 $cfg['Servers'][$i]['connect_type'] = 'tcp';
33 $cfg['Servers'][$i]['compress'] = true;
34 /* Select mysql if your server does not have mysqli */
35 $cfg['Servers'][$i]['extension'] = 'mysqli';
36 $cfg['Servers'][$i]['AllowNoPassword'] = true;

- Tạo user để đăng nhập
[TABLE="class: outer_border, width: 500"]
[TR]
[TD][root@svuit conf.d]# mysqladmin -u root password 123[/TD]
[/TR]
[/TABLE]

2. Tạo 1 Alias cho phpmyadmin
- Thêm đoạn code sau vào file cấu hình default.conf của nginx
[root@svuit conf.d]# vi /etc/nginx/conf.d/default.conf

########################################### php Myadmin #############
location /phpmyadmin{
alias /usr/share/phpMyAdmin/;
try_files $uri $uri/ /index.php;
}
location ~ ^/phpmyadmin(.+\.php)$ {
alias /usr/share/phpMyAdmin$1;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/share/phpMyAdmin$1;
include fastcgi_params;
}
#############################################################################

- Khởi động lại dịch vụ nginx
[TABLE="class: outer_border, width: 500"]
[TR]
[TD][root@svuit conf.d]# service nginx restart[/TD]
[/TR]
[/TABLE]

- Bây giờ bạn thử login vào trang phpmyadmin thành công với đường dẫn

 
Back
Top