linux練習題十六

2021-10-05 22:04:10 字數 2096 閱讀 7822

目錄

一、使用ansible的playbook實現自動化安裝httpd

二、建立httpd伺服器,要求提供兩個基於名稱的虛擬主機: 

檢查yml檔案:

執行任務:

(1)www.x.com,頁面檔案目錄為/web/vhosts/x;錯誤日誌為/var/log/httpd/x.err,訪問日誌為/var/log/httpd/x.access

(2)www.y.com,頁面檔案目錄為/web/vhosts/y;錯誤日誌為 /var/log/httpd/www2.err,訪問日誌為/var/log/httpd/y.access

(3)為兩個虛擬主機建立各自的主頁檔案index.html,內容分別為其對應的主機名

服務端:

documentroot "/web/vhosts/x" #頁面目錄

customlog "/var/log/httpd/x.access" combined #訪問日誌

errorlog "/var/log/httpd/x.err" #錯誤日誌

require all granted

addoutputfilterbytype deflate text/plain

addoutputfilterbytype deflate text/html

deflatecompressionlevel 9

servername www.y.com

documentroot "/web/vhosts/y" #頁面目錄

customlog "/var/log/httpd/y.access" combined #訪問日誌

errorlog "/var/log/httpd/www2.err" #錯誤日誌

require all granted

addoutputfilterbytype deflate text/plain

addoutputfilterbytype deflate text/html

deflatecompressionlevel 9

mkdir -pv /web/vhosts/

touch /web/vhosts

echo 'www.x.com' >/web/vhosts/x/index.html

echo 'www.y.com' >/web/vhosts/y/index.html

客戶端:

vim /etc/hosts

新增一行:

192.168.44.7 www.x.com www.y.com

測試:curl www.x.com

curl www.y.com

測試結果:

PTA的Python練習題(十六)

第4章 15 換硬幣 挺難的,這裡學到乙個range的用法 也就是說range函式能實現順序和倒序,取決於step是正是負 count 0 x int input a x 5 for m in range a,0,1 b x m 5 2 for n in range b,0,1 c x 5 m 2 ...

linux命令練習題

1 統計 usr bin 目錄下的檔案個數 ls usr bin wc l2 取出當前系統上所有使用者的shell,要求,每種shell只顯示一次,並且按順序進行顯示 cut d f7 etc passwd sort u3 取出 etc inittab檔案的第6行 head 6 etc initta...

Linux基礎練習題

案例 複製 刪除 移動 在目錄 opt下建立乙個子目錄 nsd 在目錄 opt nsd 建立檔案readme.txt,利用vim寫入內容 i love linux 將 etc passwd 和 etc resolv.conf同時拷貝到 opt nsd目錄下 將檔案 etc redhat releas...