1、下載DVWA之后解壓到 var/www/html目錄下
unzip DVWA-master.zip -d /usr/www/html
2、配置
打開終端,執行以下命令:
將apache2停止:service apache2 stop
給dvwa文件夾相應的權限:chmod -R 755 /var/www/html/dvwa
啟動mysql服務: service mysql start
打開mysql: mysql -u root -p
創建數據庫:create database dvwa;
退出mysql:exit
啟動apache2服務:service apache2 start
打開瀏覽器,在地址欄中輸入 127.0.0.1/dvwa

3、頁面出現Could not connect to the MySQL service.
Please check the config file.,
修改配置文件, 找到/var/www/html/dvwa/config文件夾,打開其中的config.inc.php文件,將$_DVWA[ 'db_password' ] = 'p@ssw0rd'; 這一行改為$_DVWA[ 'db_password' ] = '';
重新點擊創建表
問題還是等不到解決再進行下一步操作
4、更改配置
問題:PHP function allow_url_include: Disabled
處理:編緝/etc/php.ini將allow_url_include值由Off改為On

問題:PHP module gd: Missing
處理:yum install -y php-gd

問題:reCAPTCHA key: Missing
處理:編緝dvwa/config/config.inc.php
配置$_DVWA[ 'recaptcha_public_key' ] = '6LdK7xITAAzzAAJQTfL7fu6I-0aPl8KHHieAT_yJg';
配置$_DVWA[ 'recaptcha_private_key' ] = '6LdK7xITAzzAAL_uw9YXVUOPoIHPZLfw2K1n5NVQ';
問題:Unable to connect to the database
處理:編緝dvwa/config/config.inc.php,將$_DVWA[ 'db_password' ]的值改成自己設的數據庫root賬號的密碼

配置環境
開啟 MySQL
service mysql start
運行 mysql -u root 連接 MySQL 並設置 MySQL root 密碼
mysql -u root
Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 43 Server version: 10.1.21-MariaDB-5+b1 Debian 9.0 Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> use mysql \\使用數據庫 mysql Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed MariaDB [mysql]> update user set password=PASSWORD('xxxxxx') where User='root'; \\更改 root 密碼為 xxxxxx Query OK, 4 rows affected (0.00 sec) Rows matched: 4 Changed: 4 Warnings: 0 MariaDB [mysql]> flush privileges; \\刷新 MySQL 的系統權限相關表 Query OK, 0 rows affected (0.00 sec) MariaDB [mysql]> create database dvwa; \\創建數據庫 dvwa Query OK, 1 row affected (0.00 sec) MariaDB [mysql]> quit \\退出 Bye
配置 PHP
GD 支持
apt-get install php7.0-gd
編輯 /etc/php/7.0/apache2/php.ini 修改 824 行 allow_url_include = Off 為 allow_url_include = On 保存退出
vim /etc/php/7.0/apache2/php.ini
開啟 Apache
service apache2 start
下載 配置 DVWA
下載
wget https://github.com/ethicalhack3r/DVWA/archive/master.zip
配置
mv master.zip /var/www/html cd /var/www/html unzip master.zip mv DVWA-master dvwa chown www-data:www-data /var/www/html/dvwa/hackable/uploads chown www-data:www-data /var/www/html/dvwa/external/phpids/0.6/lib/IDS/tmp/phpids_log.txt cd dvwa/config vim config.inc.php \\編輯配置文件
修改第 18 行 $_DVWA[ 'db_password' ] = 'p@ssw0rd'; 將p@ssw0rd改為你前面設置的 MySQL root 密碼 如 xxxxxx ,保存退出。
打開瀏覽器輸入 ip/dvwa/setup.php 如本機 127.0.0.1/dvwa/setup.php
