实现一个 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

相关文章
相关标签/搜索