解释一下标题
如果我们想修改nginx的配置,想更改nginx中的资源文件怎么办?就是将容器中的目录和本机目录做映射,以达到修改本机目录文件就影响到容器中的文件。
一、本机创建文件夹
- 大致结构
/home
|---panwei
|----nginx
|----conf.d
|----html
二、 在conf.d文件夹下新建default.conf文件
server {
listen 80;
server_name localhost;
# 原来的配置,匹配根路径
#location / {
# root /usr/share/nginx/html;
# index index.html index.htm;
#}
# 更该配置,匹配/路径,修改index.html的名字,用于区分该配置文件替换了容器中的配置文件
location / {
root /usr/share/nginx/html;
index index-test.html index.htm;
}
}
三、在html中编写index-test.html,用以判断文件夹映射成功
<html>
<body>
<h1>this is homePa