
配置NFS服务器作为 ngxin 服务的存储目录,并在目录中创建 index.html 文件,当访问 http://你的IP 地址时,可以成功显示 index.html 文件的内容。
配置NFS服务器作为 ngxin 服务的存储目录,并在目录中创建 index.html 文件,当访问 http://你的IP 地址时,可以成功显示 index.html 文件的内容。
要求
配置NFS服务器作为 ngxin 服务的存储目录,并在目录中创建 index.html 文件,当访问 http://你的IP 地址时,可以成功显示 index.html 文件的内容。
1、创建两台虚拟机
一台系统为RHEL的虚拟机作为NFS服务器,另一台为openEuler系统的作为WEB服务器
- 在红色方框内单击右键 → 选择管理 → 克隆
- 选择下一页
- 选择虚拟机中的当前状态,点击下一页
- 选择创建完整克隆,点击下一页
- 修改名称和位置,点击完成即可
红帽系统虚拟机克隆步骤同上
2、环境初始化
- 单击右键红色框,选择重命名
- 重命名为web(红帽系统为server)
2.1 RHEL系统的虚拟机配置仓库并挂载
RHEL系统的虚拟机配置仓库并挂载,为下载软件做准备
openEuler系统的虚拟机不用配置
2.2 RHEl配置仓库
[root@localhost ~]# cat /etc/yum.repos.d/dnf.repo
[BaseOS]
name=BaseOS
baseurl=/mnt/BaseOS
gpgcheck=0
[AppStream]
name=AppStream
baseurl=/mnt/AppStream
gpgcheck=0
[root@localhost ~]# yum repolist
#yum repolist 命令用于显示当前系统上启用的 YUM(Yellowdog Updater Modified)软件仓库列表
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered with an entitlement server. You can use "rhc" or "subscription-manager" to register.
repo id repo name
AppStream AppStream
BaseOS BaseOS
2.3 挂载
[root@localhost ~]# mount /dev/sr0 /mnt
mount: /mnt: WARNING: source write-protected, mounted read-only.
[root@localhost ~]# ls /mnt #列出位于 /mnt 目录下的所有文件和子目录
AppStream EULA images RPM-GPG-KEY-redhat-beta
BaseOS extra_files.json isolinux RPM-GPG-KEY-redhat-release
EFI GPL media.repo
2.4 安装基本软件
两台虚拟机都要安装。OE系统安装基本软件会有点慢
dnf install net-tools wget curl bash-completion vim -y
2.5 修改主机名
一台为server,另一台为web。
修改后要断开重新登陆名字才会使用
[root@localhost ~]# hostnamectl hostname server
[root@localhost ~]# hostnamectl hostname
server
[root@localhost ~]# hostnamectl hostname web
[root@localhost ~]# hostnamectl hostname
web
3、配置固定ip
对ip地址进行查看,要注意是ens160还是ens33
两个虚拟机都要配置,注意网段应该是自己的不需要变(我的网段是88)
- RHEL网络
[root@server ~]# nmcli c modify ens160 ipv4.method manual ipv4.addresses 192.168.88.7/24 ipv4.dns 223.5.5.5 ipv4.gateway 192.168.88.2 connection.autoconnect yes
[root@server ~]# nmcli c up ens160 #激活名为 ens160 的网络连接。使用该命令后xshell会断开,需要重新连接。
#nmcli c modify ens160:这部分命令表示要修改名为 ens160 的网络连接配置。nmcli 是 NetworkManager 的命令行工具,允许用户通过命令行添加、修改和管理网络连接。c 是 connection 的缩写。
#ipv4.method manual:设置 IPv4 配置的方法为手动(manual)。这意味着将使用静态IP地址配置,而不是通过DHCP自动获取地址。
#ipv4.addresses 192.168.88.7/24:指定静态IPv4地址为 192.168.88.7,子网掩码为 /24(即255.255.255.0),这表明它位于一个典型的C类私有网络中。
#ipv4.dns 223.5.5.5:设置首选的 DNS 服务器为 223.5.5.5。这是阿里云提供的公共DNS服务之一。
#ipv4.gateway 192.168.88.2:指定默认网关为 192.168.88.2。
#connection.autoconnect yes:设置此连接为系统启动时自动连接。
- OE网络
注意:对ip地址进行查看,发现是ens33,不是ens160
[root@web ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host noprefixroute
valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 00:0c:29:e8:2e:01 brd ff:ff:ff:ff:ff:ff
inet 192.168.88.129/24 brd 192.168.88.255 scope global dynamic noprefixroute ens33
valid_lft 1297sec preferred_lft 1297sec
inet6 fe80::20c:29ff:fee8:2e01/64 scope link noprefixroute
valid_lft forever preferred_lft forever
[root@web ~]# nmcli connection modify ens33 ipv4.method manual ipv4.addresses 192.168.88.8/24 ipv4.dns 223.5.5.5 ipv4.gateway 192.168.88.2 connection.autoconnect yes
[root@web ~]# nmcli connection up ens33
4、安装服务(server要挂载)
安装 nfs 服务,两台虚拟机上都要进行。由于上面步骤3断开了连接,所以server服务器要再次挂载,不挂载直接安装会导致安装失败,注意要挂载
[root@server ~]# mount /dev/sr0 /mnt
mount: /mnt: WARNING: source write-protected, mounted read-only.
[root@server ~]# dnf install nfs-utils -y
[root@web ~]# dnf install nfs-utils -y
#dnf 是调用软件包管理器。
#install 是告诉 DNF 执行安装操作。
#nfs-utils 是要安装的软件包名称,NFS 工具用于配置和管理 NFS(Network File System)共享。
#-y 参数表示对所有提示自动回答“是”,这样在安装过程中不需要用户手动确认即可自动完成安装过程
5、启动NFS服务
两台虚拟机都要执行
- start 命令用于立即启动指定的服务
- status 命令用于检查指定服务的状态。
- enable 命令的作用是设置服务开机自启。
[root@server ~]# systemctl start nfs-server
[root@server ~]# systemctl status nfs-server
● nfs-server.service - NFS server and services
Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; disabled; preset: disabled)
Active: active (exited) since Sun 2025-03-16 10:36:20 CST; 25s ago
Docs: man:rpc.nfsd(8)
man:exportfs(8)
Process: 2217 ExecStartPre=/usr/sbin/exportfs -r (code=exited, status=0/SUCCESS)
Process: 2218 ExecStart=/usr/sbin/rpc.nfsd (code=exited, status=0/SUCCESS)
Process: 2238 ExecStart=/bin/sh -c if systemctl -q is-active gssproxy; then systemctl r>
Main PID: 2238 (code=exited, status=0/SUCCESS)
CPU: 88ms
Mar 16 10:36:19 server systemd[1]: Starting NFS server and services...
Mar 16 10:36:20 server systemd[1]: Finished NFS server and services.
[root@server ~]# systemctl enable nfs-server
Created symlink /etc/systemd/system/multi-user.target.wants/nfs-server.service → /usr/lib/systemd/system/nfs-server.service.
[root@web ~]# systemctl start nfs-server
[root@web ~]# systemctl status nfs-server
● nfs-server.service - NFS server and services
Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; disabled; preset: disabled)
Active: active (exited) since Sun 2025-03-16 18:36:19 CST; 25s ago
Process: 1970 ExecStartPre=/usr/sbin/exportfs -r (code=exited, status=0/SUCCESS)
Process: 1973 ExecStart=/usr/sbin/rpc.nfsd (code=exited, status=0/SUCCESS)
Main PID: 1973 (code=exited, status=0/SUCCESS)
Mar 16 18:36:19 web systemd[1]: Starting NFS server and services...
Mar 16 18:36:19 web systemd[1]: Finished NFS server and services.
[root@web ~]# systemctl enable nfs-server
Created symlink /etc/systemd/system/multi-user.target.wants/nfs-server.service → /usr/lib/systemd/system/nfs-server.service.
6.在防火墙中放行服务
两台虚拟机都要执行
- firewall-cmd 是一个命令行工具,用于配置和管理防火墙服务在基于 firewalld 的系统上。使用 firewall-cmd,你可以执行诸如开放或关闭端口、添加或移除服务、查看当前激活的规则等操作。
- firewall-cmd --permanent --add-service=nfs 命令用于将 NFS 服务永久添加到防火墙规则中。
- firewall-cmd --reload 命令重新加载防火墙配置,使得之前使用 --permanent 设置的新规则立即生效。
- firewall-cmd --list-all 则用于列出当前防火墙的所有配置信息,包括默认的区域、公开的端口、信任的服务等。
[root@server ~]# firewall-cmd --permanent --add-service=nfs
success
[root@server ~]# firewall-cmd --reload
success
[root@server ~]# firewall-cmd --list-all
public (active)
target: default
icmp-block-inversion: no
interfaces: ens160
sources:
services: cockpit dhcpv6-client nfs ssh
ports:
protocols:
forward: yes
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:
[root@web ~]# firewall-cmd --permanent --add-service=nfs
success
[root@web ~]# firewall-cmd --reload
success
[root@web ~]# firewall-cmd --list-all
public (active)
target: default
icmp-block-inversion: no
interfaces: ens33
sources:
services: dhcpv6-client mdns nfs ssh
ports:
protocols:
forward: yes
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
可以看出services中已经有了nfs服务
7、关闭Selinux
两台虚拟机中都要执行
- sed:调用流编辑器。
- -i:这个选项告诉 sed 直接在文件内进行编辑(即就地编辑),而不是输出到标准输出(屏幕)。这意味着指定的文件将会被直接修改。
- “s/^SELINUX=enforcing$/SELINUX=permissive/g”:这是实际执行替换操作的脚本部分
3.1 s/ 表示这是一个替换命令;
3.2 ^SELINUX=enforcing$ 是正则表达式,用来匹配整行内容仅为 SELINUX=enforcing 的行。这里,
^ 表示一行的开始,$ 表示一行的结束,确保只匹配完全等于 SELINUX=enforcing 的行。
3.3 SELINUX=permissive 是替换后的内容。
3.4 /g 标志表示全局替换。由于我们使用了起始(^)和结束($)标记来限定整个行必须完全匹配,因此每行最多只会发生一次替换。所以这里的 /g 实际上不会起到多次替换的效果,但通常包含它是一个好的实践,特别是当你的模式不严格匹配整行时。
- /etc/selinux/config:这是要修改的目标文件路径。
# 临时关闭
[root@server ~]# setenforce 0
# 永久关闭
[root@server ~]# sed -i "s/^SELINUX=enforcing$/SELINUX=permissive/g" /etc/selinux/config
# 临时关闭
[root@web ~]# setenforce 0
# 永久关闭
[root@web ~]# sed -i "s/^SELINUX=enforcing$/SELINUX=permissive/g" /etc/selinux/config
[root@web ~]# getenforce
Permissive
8、配置NFS服务
在 server 主机上创建共享目录,并暴露给客户端。
即在 NFS 服务器上设置一个共享目录,并确保该目录可以被 192.168.88.0/24 网络段内的客户端访问
8.1创建共享目录
[root@server ~]# mkdir /nfs/data -p
8.2 配置共享存储
[root@server ~]# cat > /etc/exports <<EOF
> /nfs/data 192.168.88.0/24(rw,sync)
> EOF
- 这部分命令使用了输入重定向和 here-document 技术来编辑 /etc/exports 文件。
- /etc/exports 文件定义了哪些文件系统可以通过 NFS 导出给其他机器以及相应的选项。
- /nfs/data 192.168.88.0/24(rw,sync):
-
- /nfs/data 是要共享的目录;
-
- 192.168.88.0/24 指定了允许访问这个共享目录的网络或主机。在这里,表示整个 192.168.88.0/24 子网的机器都可以访问。
-
- (rw,sync) 定义了访问权限和其他选项:rw 表示读写权限;sync 强制要求对文件的操作必须同步到磁盘后再返回成功,提高了数据完整性但可能会稍微降低性能。
8.3 重启服务
重启了 NFS 服务,以便使新的 /etc/exports 配置生效。重启 NFS 服务会重新读取 /etc/exports 文件,并根据其中的设定更新导出的文件系统列表。
[root@server ~]# systemctl restart nfs-server.service
8.4 查看共享列表
#showmount 是一个用于查询 NFS 服务器信息的工具。
#参数 -e 后面跟的是 NFS 服务器的 IP 地址(在这是 192.168.88.7),这条命令将显示指定 NFS 服务器上所有可用的共享。
[root@server ~]# showmount -e 192.168.88.7
Export list for 192.168.88.7:
/nfs/data 192.168.88.0/24
输出结果表明 NFS 服务器已正确配置并正在共享 /nfs/data 目录给 192.168.88.0/24 网络段内的客户端。
9、配置NFS客户端
在web服务器上操作
9.1 在客户端上创建挂载目录
这条命令用于在客户端机器上创建一个名为 /var/nginx 的目录。
挂载 NFS 共享之前必须做的准备工作,确保有一个地方可以挂载远程文件系统。
[root@web ~]# mkdir /var/nginx -p
9.2 执行挂载
使用 mount 命令挂载 NFS 共享:
- -t nfs 指定了文件系统的类型为 NFS;
- 192.168.88.7:/nfs/data 是 NFS 服务器的 IP 地址和要挂载的共享目录路径。NFS 服务器的 IP 地址是 192.168.88.7,而共享目录是 /nfs/data;
- /var/nginx 是本地挂载点,即远程 NFS 共享目录将在本地系统中被访问的路径。
运行 df -h 命令来显示磁盘空间使用情况,“-h”选项以人类可读的格式(如 KB, MB, GB)显示信息。
输出结果显示了所有已挂载文件系统的概览,包括本地文件系统和刚刚挂载的 NFS 共享。
- Filesystem:列出每个文件系统的设备名称。
- Size、Used、Avail、Use%:分别表示文件系统的总大小、已用空间、可用空间以及使用百分比。
- Mounted on:指出每个文件系统挂载到本地文件树的位置
[root@web ~]# mount -t nfs 192.168.88.7:/nfs/data /var/nginx
[root@web ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/openeuler-root 45G 1.8G 41G 5% /
devtmpfs 4.0M 0 4.0M 0% /dev
tmpfs 1.7G 0 1.7G 0% /dev/shm
tmpfs 4.0M 0 4.0M 0% /sys/fs/cgroup
tmpfs 675M 9.1M 666M 2% /run
tmpfs 1.7G 0 1.7G 0% /tmp
/dev/nvme0n1p2 974M 175M 732M 20% /boot
192.168.88.7:/nfs/data 45G 1.7G 43G 4% /var/nginx
[root@web ~]#
为了能够写文件,我们还需要将 NFS 服务端的共享目录的写权限加上。
前面已经为 NFS 共享目录 /nfs/data 设置了读写权限(通过 /etc/exports 文件中的 rw 参数),但是还需要确保该目录的本地文件系统权限允许其他用户(即 NFS 客户端)进行写操作。这是因为在 Linux 系统中,NFS 共享的访问权限由两部分控制:一部分是 NFS 导出配置(如 /etc/exports 文件中的设置),另一部分是共享目录自身的文件系统权限。
NFS 配置 (/etc/exports) 中的权限:
前面在 /etc/exports 中添加了 /nfs/data 192.168.72.0/24(rw,sync),这告诉 NFS 服务器允许来自 192.168.72.0/24 网络段内的客户端对 /nfs/data 目录有读写(rw)访问权限。
文件系统级别的权限:
在你最初列出的 /nfs/data 目录权限为 drwxr-xr-x.,这意味着:
所有者(root)有读、写和执行权限。
组用户有读和执行权限。
其他用户只有读和执行权限,没有写权限。
这意味着,即使 NFS 配置允许写入,如果文件系统本身不赋予其他用户写权限,则 NFS 客户端仍然无法写入这个目录。
为什么需要再次添加写权限 (chmod o+w /nfs/data):
添加 o+w 权限给 /nfs/data 目录是为了确保其他用户(包括从 NFS 客户端访问此目录的用户)能够在此目录下创建新文件或修改现有文件。
修改后的权限变为 drwxr-xrwx.,表示所有用户(包括其他用户)现在都有对该目录的写权限,这样就保证了 NFS 客户端可以按照 NFS 导出配置中的设定来访问(读写)该目录。
[root@server ~]# ll -d /nfs/data
drwxr-xr-x. 2 root root 6 Mar 16 11:25 /nfs/data
[root@server ~]# chmod o+w /nfs/data
[root@server ~]# ll -d /nfs/data
drwxr-xrwx. 2 root root 6 Mar 16 11:25 /nfs/data
- 这里的第一个字符 d 表示该项是一个目录(directory)。
-
- 如果该项是一个普通文件,则此处会是一个 -;
-
- 如果是链接,则是 l(link);
-
- 如果是块设备文件,则是 b;
-
- 如果是字符设备文件,则是 c;
-
- 其他类型还有管道(p)和套接字(s)等。
10、验证是否可读可写
1)在 NFS 服务端写一个文件。
[root@server ~]# echo hello nfs > /nfs/data/index.html
在 NFS 客户端查看:
[root@web ~]# cat /var/nginx/index.html
hello nfs
从而可以发现读没有问题。
2)在 NFS 客户端写一个文件
[root@web ~]# echo write nfs > /var/nginx/test
然后在 NFS 服务端查看
[root@server ~]# cat /nfs/data/test
write nfs
写操作也是OK的
11、搭建nginx服务
web服务器上操作
11.1安装nginx
有两种安装方法:本地安装和官方安装
# 使用本地仓库安装
[root@web ~]# dnf install nginx -y
# 卸载本地仓库安装
[root@web ~]# dnf remove nginx -y
# ngin官方仓库安装
# 1. 配置nginx官方仓库
[root@web ~]# vim /etc/yum.repos.d/nginx.repo
[root@web ~]# cat /etc/yum.repos.d/nginx.repo
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true
[nginx-mainline]
name=nginx mainline repo
baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true
# 2. 安装nginx
[root@web ~]# dnf install nginx -y
11.2 查看服务
我们查找 nginx 的启动服务文件:
[root@web ~]# find / -name nginx.service
/usr/lib/systemd/system/nginx.service
查看这个文件的内容:
[root@web ~]# vim /usr/lib/systemd/system/nginx.service
[Unit]
Description=The nginx HTTP and reverse proxy server
After=network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
PIDFile=/run/nginx.pid
# Nginx will fail to start if /run/nginx.pid already exists but has the wrong
# SELinux context. This might happen when running `nginx -t` from the cmdline.
ExecStartPre=/usr/bin/rm -f /run/nginx.pid
ExecStartPre=/usr/sbin/nginx -t
ExecStart=/usr/sbin/nginx
#ExecStop=/usr/sbin/nginx -s stop | quit
ExecReload=/bin/kill -s HUP $MAINPID
KillSignal=SIGQUIT
TimeoutStopSec=5
KillMode=mixed
PrivateTmp=true
[Install]
WantedBy=multi-user.target
11.3 启动nginx
[root@web ~]# systemctl start nginx
[root@web ~]# systemctl status nginx
● nginx.service - The nginx HTTP and reverse proxy server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; preset: disabled)
Active: active (running) since Sun 2025-03-16 20:43:28 CST; 8s ago
Process: 2352 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)
Process: 2356 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=0/SUCCESS)
Process: 2360 ExecStart=/usr/sbin/nginx (code=exited, status=0/SUCCESS)
Main PID: 2361 (nginx)
Tasks: 5 (limit: 21357)
Memory: 11.0M ()
CGroup: /system.slice/nginx.service
├─2361 "nginx: master process /usr/sbin/nginx"
├─2362 "nginx: worker process"
├─2363 "nginx: worker process"
├─2364 "nginx: worker process"
└─2365 "nginx: worker process"
Mar 16 20:43:28 web systemd[1]: Starting The nginx HTTP and reverse proxy server...
Mar 16 20:43:28 web nginx[2356]: nginx: the configuration file /etc/nginx/nginx.conf syntax>
Mar 16 20:43:28 web nginx[2356]: nginx: configuration file /etc/nginx/nginx.conf test is su>
Mar 16 20:43:28 web systemd[1]: Started The nginx HTTP and reverse proxy server.
11.4 查看nginx.conf配置文件
[root@web ~]# vim /etc/nginx/nginx.conf
11.5 配置web服务
- [root@web ~]# vim /etc/nginx/conf.d/nfs.conf
-
- 使用 vim 文本编辑器打开或创建 /etc/nginx/conf.d/nfs.conf 文件。Nginx 常常会在/etc/nginx/conf.d/ 目录下查找额外的配置文件,这些文件通常以 .conf 结尾。
- [root@web ~]# cat /etc/nginx/conf.d/nfs.conf 这条命令显示了你在 nfs.conf 文件中添加的配置内容
-
- server 块定义了一个虚拟主机。
-
- access_log 和 error_log 分别指定了访问日志和错误日志的位置。
-
- server_name 定义了该虚拟主机响应的域名或 IP 地址,在这里设置为 192.168.88.8,即你的web服务器IP地址。
-
- root /var/nginx/; 设置了网站根目录,指向了你之前通过 NFS 挂载的 /var/nginx/ 目录。这意味着当你访问这个服务器时,Nginx 将会从 /var/nginx/ 目录提供文件。
# 配置一个web服务
[root@web ~]# vim /etc/nginx/conf.d/nfs.conf
[root@web ~]# cat /etc/nginx/conf.d/nfs.conf
server {
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
server_name 192.168.88.8;
root /var/nginx/;
}
# 验证配置文件是否有效
[root@web ~]# /usr/sbin/nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
# 重启 nginx 服务
[root@web ~]# systemctl restart nginx #使配置生效
11.6 放行80端口
[root@web ~]# firewall-cmd --permanent --add-port=80/tcp
success
[root@web ~]# firewall-cmd --reload
success
[root@web ~]# firewall-cmd --list-all
public (active)
target: default
icmp-block-inversion: no
interfaces: ens33
sources:
services: dhcpv6-client mdns nfs ssh
ports: 80/tcp
protocols:
forward: yes
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:
12、浏览
打开浏览器,输入 http://192.168.88.8 来访问:
或者使用 curl 来测试
[root@web ~]# curl http://192.168.88.8 #这条命令使用 curl 发送一个 HTTP 请求到 IP 地址为 192.168.88.8 的 Web 服务器,并打印出返回的内容。
hello nfs
[root@web ~]# curl http://192.168.88.8 -I #-I 参数告诉 curl 只请求 HTTP 响应的头部信息,而不下载实际的内容。
HTTP/1.1 200 OK
Server: nginx/1.24.0
Date: Sun, 16 Mar 2025 13:04:35 GMT
Content-Type: text/html
Content-Length: 10
Last-Modified: Sun, 16 Mar 2025 04:35:01 GMT
Connection: keep-alive
ETag: "67d654f5-a"
Accept-Ranges: bytes
#HTTP/1.1 20/XMLSchema 200 OK:表示请求成功,状态码 200 表示服务器成功处理了请求。
#Server: nginx/1.24.0:标识了提供服务的服务器软件及其版本号。
#Date:服务器响应的时间。
#Content-Type: text/html:指示返回的内容类型为 HTML 文本。
#Content-Length: 10:响应体的长度为 10 字节,对应于之前 curl 请求直接获取的内容“hello nfs”(不包括换行符)。
#Last-Modified:该资源最后一次被修改的时间。
#Connection: keep-alive:表示使用持久连接,允许在同一连接上发送多个请求。
#ETag:用于缓存验证的实体标签。
#Accept-Ranges: bytes:表示服务器支持字节范围请求,允许客户端请求部分文件内容。
更多推荐
所有评论(0)