基于nginx,mysql,php搭建DVWA环境。
第一种方法:LNMP集成包安装LNMP.org
第二种:
nginx源:
yum localinstall http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
安装nginx
yum install -y nginx
mysql源:
yum localinstall http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm
mysql安装:
yum install -y mysql-community-server
grep -rn 'password' /var/log/mysqld.log
第二种方法:
也可以修改mysql配置文件
/etc/my.cof
加入 skip-grant-tables 重启服务,修改完密码后记得删除。
登录mysql修改密码
注意密码策略
ALTER USER 'root'@'localhost' IDENTIFIED BY 'youpassword';
set global validate_password_policy=LOW; //密码等级
set global validate_password_length=6; //长度6
update mysql.user set authentication_string=PASSWORD('123456') where user='root';
yum install -y php php-devel php-fpm php-mysql php-common php-devel php-gd libjpeg* php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-bcmath php-mhash libmcrypt libmcrypt-devel
ps:这一步会装许多依赖,如果没装上会报很多错,报错需要编译安装
排错:
出现 php-fpm出现File not found
是nginx无法识别路径,修改配置文件:
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
把本地的dvwa包scp到centos上
scp dvwn.zip [email protected]:/root/dvwn.zip
cp -r DVWA-1.9/ /usr/share/nginx/html/
/usr/share/nginx/html/DVWA-1.9/config/config.inc.php
还是有报错
修改php.ini
修改etc下php.ini 的 allow_url_include 改为On
重启服务
reCAPTCHA key:Missing 报错
自己注册或者复制粘贴:reCAPTCHA
/usr/share/nginx/html/DVWA/config/config.inc.php
$_DVWA[ ‘recaptcha_public_key‘ ] = ‘6LdK7xITAAzzAAJQTfL7fu6I-0aPl8KHHieAT_yJg‘;
$_DVWA[ ‘recaptcha_private_key‘ ] = ‘6LdK7xITAzzAAL_uw9YXVUOPoIHPZLfw2K1n5NVQ‘;
Writable folder /usr/share/nginx/html/DVWA/hackable/uploads/: No 报错文件无权限
授权即可,但是还是会报无权限,不用管跳过即可。
正常访问