實現一個 web 服務器

在 system1 上配置一個站點 http://system1.group8.example.com/,而後執行下述步驟:html

一、從 http://server.group8.example.com/pub/system1.html 下載文件,而且將文件重名爲 index.html 不要修改此文件的內容web

二、將文件 index.html 拷貝到您的 web 服務器的 DocumentRoot 目錄下vim

三、來自於 group8.example.com 域的客戶端能夠訪問此web服務服務器

四、來自於my133t.org域的客戶端拒絕訪問此web服務curl

  • 版本:Apache 2.4 +

答:ui

一、安裝軟件包url

yum install httpd -y

二、創建配置文件spa

vim /etc/httpd/conf.d/httpd-vhosts.confcode

<VirtualHost *:80>
    DocumentRoot "/var/www/html"
    ServerName system1.group8.example.com
    
    <Directory "/var/www/html">
        <RequireAll>
            Require all granted
            Require not host .my133t.org
        </RequireAll>
    </Directory>
</VirtualHost>
# 下載文件致使定目錄內
wget -O /var/www/html/index.html http://server.group8.example.com/pub/system1.html

三、設置服務開機自啓動並啓動服務server

systemctl enable httpd
systemctl start httpd

四、配置防火牆

firewall-cmd --permanent --add-service=http
firewall-cmd --reload

驗證:再system2 上執行

curl system1.group8.example.com

更多詳情:https://www.cnblogs.com/xiangsikai/p/9111688.html

相關文章
相關標籤/搜索