创建Nginx容器,同时提供配置文件和网页文件
映射配置文件和网站
// 真机网站存放位置
[root@localhost ~]
articles.xls game.html images index.html js style
// 拉取一个nginx镜像
[root@localhost ~]
[root@localhost ~]
REPOSITORY TAG IMAGE ID CREATED SIZE
nginx latest f652ca386ed1 4 days ago 141MB
busybox latest d23834f29b38 7 days ago 1.24MB
centos latest 5d0da3dc9764 2 months ago 231MB
// 制作一个网站映射
[root@localhost ~]
/
[root@localhost ~]
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
353751ed8264 busybox "sh" 5 seconds ago Exited (0) 2 seconds ago html
// 使用一个测试容器登入进去查看映射情况
[root@localhost ~]
/
articles.xls images js
game.html index.html style
// 把测试的容器删除
/
[root@localhost ~]
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
64ff86f2f505 busybox "sh" 2 minutes ago Exited (0) 3 seconds ago xenodochial_brattain
353751ed8264 busybox "sh" 2 minutes ago Exited (0) 2 minutes ago html
[root@localhost ~]
64ff86f2f505
[root@localhost ~]
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
353751ed8264 busybox "sh" 4 minutes ago Exited (0) 4 minutes ago html
// 创建配置文件存放目录
[root@localhost ~]
[root@localhost ~]
// 先用yum安装一个nginx
[root@localhost ~]
[root@localhost ~]
// 默认配置文件存放位置
[root@localhost ~]
conf.d mime.types.default
default.d nginx.conf
fastcgi.conf nginx.conf.default
fastcgi.conf.default scgi_params
fastcgi_params scgi_params.default
fastcgi_params.default uwsgi_params
koi-utf uwsgi_params.default
koi-win win-utf
mime.types
// 复制配置文件到config目录下
[root@localhost ~]