目錄
一、Nginx安裝
?二、docker驗證標簽漏洞
一、Nginx安裝
1.首先創建Nginx
的目錄并進入:
mkdir /soft && mkdir /soft/nginx/cd /soft/nginx/
2.下載Nginx
的安裝包,可以通過FTP
工具上傳離線環境包,也可通過wget
命令在線獲取安裝包:
wget https://nginx.org/download/nginx-1.21.6.tar.gz
沒有wget
命令的可通過yum
命令安裝:
yum -y install wget
3.解壓Nginx
的壓縮包:
tar -xvzf nginx-1.21.6.tar.gz
4.下載并安裝Nginx
所需的依賴庫和包:
yum install --downloadonly --downloaddir=/soft/nginx/ gcc-c++
yum install --downloadonly --downloaddir=/soft/nginx/ pcre pcre-devel4
yum install --downloadonly --downloaddir=/soft/nginx/ zlib zlib-devel
yum install --downloadonly --downloaddir=/soft/nginx/ openssl openssl-devel
推薦使用yum一鍵下載:
yum -y install gcc zlib zlib-devel pcre-devel openssl openssl-devel
安裝過慢時推薦使用代理:
CentOS7安裝Proxychains實現linux代理 (taodudu.cc)?
5.通過rpm
命令依次將依賴包一個個構建,或者通過如下指令一鍵安裝所有依賴包:
rpm -ivh --nodeps *.rpm
6.進入解壓后的nginx
目錄,然后執行Nginx
的配置腳本,為后續的安裝提前配置好環境,默認位于/usr/local/nginx/
目錄下(可自定義目錄):
cd nginx-1.21.6
./configure --prefix=/soft/nginx/
因為動態訪問需要用到PHP,因此我們還要在文件中添加
./configure --prefix=/home/ring04h/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_sub_module
7.編譯并安裝Nginx
:
make && make installyum install epel-releaserpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpmyum --enablerepo=remi install php56-phpyum --enablerepo=remi install php56-php-devel php56-php-fpm php56-php-gd php56-php-xmlphp56-php-sockets php56-php-sockets php56-php-session php56-php-snmp php56-php-mysql#運行并查看版本
php56 -v
#重啟命令php-fpm
systemctl restart php56-php-fpm
#添加自動啟動
systemctl enable php56-php-fpm
#查看php7.4的安裝路徑
whereis php
#鏈接php文件
ln -s /opt/remi/php74/root/usr/bin/php /usr/bin/php
??8.最后回到前面的
/soft/nginx/
目錄,輸入ls
即可看見安裝nginx
完成后生成的文件。
?9.修改安裝后生成的conf
目錄下的nginx.conf
配置文件:
[root@localhost]# vi conf/nginx.conf修改端口號:listen ? ?80;修改IP地址:server_name 你當前機器的本地IP(線上配置域名);
10.制定配置文件并啟動Nginx
:
[root@localhost]# sbin/nginx -c conf/nginx.conf
[root@localhost]# ps aux | grep nginx
11.Nginx
其他操作命令:
sbin/nginx -t -c conf/nginx.conf # 檢測配置文件是否正常
sbin/nginx -s reload -c conf/nginx.conf # 修改配置后平滑重啟
sbin/nginx -s quit # 優雅關閉Nginx,會在執行完當前的任務后再退出
sbin/nginx -s stop # 強制終止Nginx,不管當前是否有任務在執行
12.結果驗證?
靜態:
?
動態:
?
?
?二、docker驗證標簽漏洞
1.上傳vulhub-master文件(需要文件做實驗私聊)
?2.咱們現在所要實現的標簽型漏洞是它:
3.啟動(系統會自動在docker系統中下我們想要的文件)
?4.docker鏡像慢的時候需要配置鏡像加速
- ?打開 Docker 配置文件:編輯
/etc/docker/daemon.json
文件(如果文件不存在,可以創建它): - 在
daemon.json
文件中添加以下內容,將<your-mirror-url>
替換為你的鏡像加速器地址:
{"registry-mirrors": ["https://mirror.css.tencentyun.com"]
}
5.檢測其是否可以訪問
curl http://localhost
?6.漏洞環境
Vulhub - Docker-Compose file for vulnerability environment
7.解決方法:將頭部換位第3個(不進行解碼)