当进入Discuz的用户管理界面的时候,为了为了安全先 要进入一个密码设置界面,输入正确的用户和密码才能进入admin管理界面输入其相应的用户名和密码。
1、修改虚拟主机配置文件。
[root@bogon ~]# vim /usr/local/nginx/conf/vhosts/test.conf server
{
listen 80;
server_name www.test.com;
index index.html index.htm index.php;
root /data/www;
location ~ .*admin\.php$ {
auth_basic "caimz auth";
auth_basic_user_file /usr/local/nginx/conf/.htpasswd;
include fastcgi_params;
fastcgi_pass unix:/tmp/php-fcgi1.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /data/www$fastcgi_script_name;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass unix:/tmp/php-fcgi1.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /data/www$fastcgi_script_name;
}
}
2、检测配置文件是否正确
[root@bogon ~]# /usr/local/nginx/sbin/nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
3、设置密码
[root@bogon ~]# htpasswd -c /usr/local/nginx/conf/.htpasswd caimz
New password:
Re-type new password:
Adding password for user caimz
htpasswd -c /usr/local/nginx/conf/htpasswd caimz // 添加caimz用户,第一次添加时需要加-c参数,第二次添加新用户时不需要-c参数
4、重启nginx
[root@bogon ~]# /etc/init.d/nginx restart
Stopping Nginx: [ OK ]
Starting Nginx: [ OK ]
5、浏览器访问
然后就进入了Discuz的后台管理中心
输入用户名和密码,用户名是admin 密码是123456(这个是当当初安装discuz时候设置的)