web安全系列之環境準備

準備環境

攻擊
攻擊機kali linux 2.0
靶機 centos7

安裝kali linux 2.0

安裝centos 7

安裝mysql

centos7 安裝mysql詳細流程.

關於MySQL5.7版本以上默認密碼的問題.

安裝 java

jdk下載以前版本需要的賬號.

安裝 Apache Tomcat

安裝略
停止防火牆,否則外面訪問不了

systemctl disable firewalld
systemctl stop firewalld 

安裝PHP

yum install php
yum install php-fpm.x86_64

啓動php-fpm

php-fpm -D

修改php配置

vi /etc/php.ini
查看php-fpm master進程ID
ps aux | grep php-fpm
重啓master進程
kill -USR2 2123

安裝 Nginx

CentOS 7,使用yum安裝Nginx.
nginx下php無法訪問報錯Primary script unknown的解決方法.
nginx配置

server {
    listen       80;
    server_name  localhost;

    #charset koi8-r;
    #access_log  /var/log/nginx/host.access.log  main;

    location / {
        root   /usr/share/nginx/html;
        index  index.php index.html index.htm;
    }

    #error_page  404              /404.html;

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }

    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #
    #location ~ \.php$ {
    #    proxy_pass   http://127.0.0.1;
    #}

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000

    location ~ \.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;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #    deny  all;
    #}
}

安裝 DVWA

下載DVWA
把DVWA解壓到/usr/share/nginx/html下
訪問http://xxx/DVWA/setup.php根據界面提示把標紅的解決。之後點擊下面的Create/Reset Database.即可
在這裏插入圖片描述
DVWA訪問地址
http://192.168.64.135/DVWA/

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章