Methods and steps to build nginx file server based on docker

Methods and steps to build nginx file server based on docker

1. Create a new configuration file docker_nginx.conf on this machine

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

  location /files {
    #In docker, nginx's directory alias /home/files;
    expires 1d;
    allow all;
    autoindex on;
  }

2. Start the command

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

illustrate:

  • D:\dev\nginx-1.13.6\conf\docker_nginx.con is the address of my local configuration file
  • /etc/nginx/nginx.conf is the configuration file address in docker nginx
  • D:\tools\files is the address of the local folder I want to share
  • /home/files is the address mapped in docker nginx

3. Results

Visit localhost:7070/files to see the final mapped files.

Execute the command docker exec -it nginx bash to enter docker nginx. The result is as follows

λ 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

The above is the detailed content of the method and steps for building an nginx file server based on docker. For more information about building an nginx file server with docker, please pay attention to other related articles on 123WORDPRESS.COM!

You may also be interested in:
  • Graphic tutorial on configuring nginx file server in windows 10 system
  • Nginx learning static file server configuration method
  • Detailed explanation of nginx configuration static file server
  • Detailed process of using nginx to build a webdav file server in Ubuntu

<<:  JavaScript canvas to achieve mirror image effect

>>:  Several ways to backup MySql database

Recommend

Detailed steps to expand LVM disk in Linux

1. Add a hard disk 2. Check the partition status:...

SQL merge operation of query results of tables with different columns

To query two different tables, you need to merge ...

Summary of JavaScript custom object methods

Table of contents 1. Use object to create an obje...

What is flex and a detailed tutorial on flex layout syntax

Flex Layout Flex is the abbreviation of Flexible ...

How to build a multi-node Elastic stack cluster on RHEL8 /CentOS8

Elastic stack, commonly known as ELK stack, is a ...

How to upload projects to Code Cloud in Linux system

Create a new project test1 on Code Cloud Enter th...

The hottest trends in web design UI in 2013 The most popular UI designs

Time flies, and in just six days, 2013 will becom...

Detailed explanation of count without filter conditions in MySQL

count(*) accomplish 1. MyISAM: Stores the total n...

How to set up a deployment project under Linux system

1. Modify the firewall settings and open the corr...

Detailed steps for remote deployment of MySQL database on Linux

Linux remote deployment of MySQL database, for yo...

JavaScript common statements loop, judgment, string to number

Table of contents 1. switch 2. While Loop 3. Do/W...

Introduction to the use of the indeterminate property of the checkbox

When we use the folder properties dialog box in Wi...

Detailed explanation of Zabbix installation and deployment practices

Preface Zabbix is ​​one of the most mainstream op...