Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method and steps of building nginx file server based on docker

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

1. Create a configuration file docker_nginx.conf locally

server { listen 7070; server_name localhost; charset utf-8; location /files { #nginx directory in docker alias /home/files; expires 1d; allow all; autoindex on; }

2. start 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

Description:

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

3. results

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

Execute docker exec -it nginx bash to get inside docker nginx. The result is as follows

λ docker exec -it nginx bashroot@178a892f73ce:/# lsbin boot dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr varroot@178a892f73ce:/# cd home/root@178a892f73ce:/home# lsfilesroot@178a892f73ce:/home# cd files/root@178a892f73ce:/home/files# ls2018-08-09 2018-08-13 2018-09-04root@178a892f73ce:/home/files# exitexit

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

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report