Centos7配置phpmyadmin用户名认证auth_basic

来源:互联网 发布:英翻汉软件 编辑:程序博客网 时间:2024/06/12 00:43

CentOS7配置phpmyadmin用户名认证auth_basic

接此文 CentOS7配置nginx php php-fpm mariadb phpmyadmin(yum安装) http://blog.csdn.net/shile/article/details/73535295

一. 安装httpd-tools

#yum -y install httpd-tools

二. 生成密码文件

#htpasswd -b -c /etc/nginx/htpasswd.file 'user' 'passwd'

三. 配置nginx

#vi /etc/nginx/conf.d/default.conf

在server块后面加入如下内容:

location  /pma/ {  auth_basic "phpmyadmin need http user and password";  auth_basic_user_file /etc/nginx/htpasswd.file;  index index.php;  root /usr/share/nginx/html;location ~ ^/pma/(.+\.php)$ { root /usr/share/nginx/html; fastcgi_pass  127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include    fastcgi_params; }}

保存后重新载入nginx的配置
#nginx -s reload

四. 测试效果

网址不添加index.php打开

pma

网址添加index.php打开

pma index.php

原创粉丝点击