基于docker搭建nginx文件服务器的方法步骤

1.在本机新建配置文件docker_Nginx.conf

server {
  listen    7070;
  server_name localhost;
  charset utf-8;

  location /files {
    #在docker内Nginx的目录
    alias /home/files;
    expires 1d;
    allow all;
    autoindex on;
  }

2.启动命令

docker run --name Nginx -d -p 7070:7070 -v D:\dev\Nginx-1.13.6\conf\docker_Nginx.conf:/etc/Nginx/Nginx.conf -v D:\tools\files:/home/files Nginx

说明:

3.结果

访问localhost:7070/files可以看到最终映射的文件

执行命令docker exec -it Nginx bash可以进入docker Nginx内部,结果如下

λ docker exec -it Nginx bash
root@178a892f73ce:/# ls
bin boot dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var
root@178a892f73ce:/# cd home/
root@178a892f73ce:/home# ls
files
root@178a892f73ce:/home# cd files/
root@178a892f73ce:/home/files# ls
2018-08-09 2018-08-13 2018-09-04
root@178a892f73ce:/home/files# exit
exit

以上就是基于docker搭建Nginx文件服务器方法步骤的详细内容,更多关于docker搭建Nginx文件服务器 的资料请关注编程之家其它相关文章

相关文章

今天小编给大家分享一下excel图案样式如何设置的相关知识点,...
这篇文章主要讲解了“win10设置过的壁纸如何删除”,文中的讲...
这篇“Xmanager怎么显示远程linux程序的图像”文章的知识点大...
今天小编给大家分享一下xmanager怎么连接linux的相关知识点,...
这篇“如何重置Linux云服务器的远程密码”文章的知识点大部分...
本篇内容介绍了“Linux云服务器手动配置DNS的方法是什么”的...