自学内容网 自学内容网

【HICE】web服务器搭建4

自定义多个ip地址访问

1.下载httpd协议:dnf install httpd -y

2.编辑vhost.conf 

cd /etc/httpd

cd /conf.d

<directory /www>
allowoverride none
require all granted
</directory>
<virtualhost 192.168.244.130:80>
documentroot /www
servername 192.168.244.130
</virtualhost>
<virtualhost 192.168.244.131:80>
documentroot /www/131
servername 192.168.244.131
</virtualhost>
<virtualhost 192.168.244.132:80>
documentroot /www/132
servername 192.168.244.132
</virtualhost>

3.重启服务:systemctl restart httpd

4.关闭防火墙:systemctl stop firewalld

                        setenforce 0

5.部署网页

mkdir /www/{131,132}

echo 131 > /www/131/index.html

echo 132 > /www/132/index.html

6.配置静态ip并增加ip

nmcli connection modify ens160 ipv4.addresses 192.168.244.130/24

nmcli connection modify ens160 ipv4.gateway 192.168.244.2

nmcli connection modify ens160  ipv4.method manual

nmcli connection modify ens160 connection.autoconnect  yes

nmcli connection up ens160

nmcli connection modify ens160 +ipv4.addresses 192.168.244.131/24

nmcli connection modify ens160 +ipv4.addresses 192.168.244.132/24

nmcli connection up ens160

7.ip访问浏览器并查看 验证是否成功


原文地址:https://blog.csdn.net/m0_64570996/article/details/140163333

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!