http作业

1.关闭防火墙

复制代码
[root@localhost ~]# systemctl stop firewalld   #关闭防火墙
[root@localhost ~]# setenforce  0

2.下载nginx包

复制代码
[root@localhost ~]# mount   /dev/sr0   /mnt #挂载目录
[root@localhost ~]# yum install nginx  -y  #下载nginx包

3.增加多条端口

复制代码
[root@localhost ~]# nmcli connection modify ens160  ipv4.method manual ipv4.addresses 192.168.92.10/24  ipv4.gateway 192.168.88.2 ipv4.dns 192.168.88.2  +ipv4.addresses 192.168.88.20/24  +ipv4.addresses 192.168.88.30/24  #当前主机添加多地址

4.期货网卡

复制代码
[root@localhost ~]# nmcli connection up ens160 #激活网卡

5.自定义nginx配置文件

复制代码
[root@localhost ~]# vim  /etc/nginx/conf.d/test_ip.conf  #自定义nginx配置文件
server {
	listen 192.168.88.10:80;
	root /test/10;
	location / {
        index  index.html;
	}
}
server {
	listen 192.168.88.20:80;
	root /test/20;
	location / { 
	    index  index.html;
	}
}
server {
        listen 192.168.88.30:80;
        root /test/30;
        location / {
            index  index.html;
        }
}
复制代码
[root@localhost ~]# mkdir /test/{10,20,30} -pv
mkdir: created directory '/test'
mkdir: created directory '/test/10'
mkdir: created directory '/test/20'
mkdir: created directory '/test/30'
[root@localhost ~]# echo this is 250 > /test/10/index.html
[root@localhost ~]# echo this is 250 > /test/20/index.html
[root@localhost ~]# echo this is 250 > /test/30/index.html

7.测试

相关推荐
Aric_Jones2 小时前
HTTP和HTTPS的区别
网络协议·http·https
Ll13045252983 小时前
如何在校园网让虚拟机联网并固定IP
网络·网络协议·tcp/ip
陌路203 小时前
Linux 34TCP服务器多进程并发
linux·服务器·网络
爱喝矿泉水的猛男3 小时前
单周期Risc-V指令拆分与datapath绘制
运维·服务器·risc-v
科技块儿3 小时前
【IP】公有&私有IP地址?
服务器·网络协议·tcp/ip
2501_915918414 小时前
移动端 HTTPS 抓包实战,多工具组合分析与高效排查指南
数据库·网络协议·ios·小程序·https·uni-app·iphone
灵神翁4 小时前
自建node云函数服务器
运维·服务器
3***49964 小时前
前端WebSocket教程,实时通信案例
网络·websocket·网络协议
狂炫冰美式4 小时前
前端实时推送 & WebSocket 面试题(2026版)
前端·http·面试
TangDuoduo00055 小时前
【IO模型与并发服务器】
运维·服务器·网络·tcp/ip