準備環境
安裝kali linux 2.0
略
安裝centos 7
略
安裝mysql
安裝 java
安裝 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/