基于docker搭建nginx文件服務(wù)器的方法步驟
發(fā)布日期:2022-02-07 14:22 | 文章來源:gibhub
1.在本機(jī)新建配置文件docker_nginx.conf
server { listen 7070; server_name localhost; charset utf-8; location /files { #在docker內(nèi)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
說明:
- D:\dev\nginx-1.13.6\conf\docker_nginx.con是我本機(jī)配置文件的地址
- /etc/nginx/nginx.conf是docker nginx內(nèi)的配置文件地址
- D:\tools\files是我本地要共享文件夾的地址
- /home/files是在docker nginx內(nèi)映射的地址
3.結(jié)果
訪問localhost:7070/files可以看到最終映射的文件。
執(zhí)行命令docker exec -it nginx bash可以進(jìn)入docker nginx內(nèi)部,結(jié)果如下
λ 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文件服務(wù)器的方法步驟的詳細(xì)內(nèi)容,更多關(guān)于docker搭建nginx文件服務(wù)器 的資料請關(guān)注本站其它相關(guān)文章!
版權(quán)聲明:本站文章來源標(biāo)注為YINGSOO的內(nèi)容版權(quán)均為本站所有,歡迎引用、轉(zhuǎn)載,請保持原文完整并注明來源及原文鏈接。禁止復(fù)制或仿造本網(wǎng)站,禁止在非www.sddonglingsh.com所屬的服務(wù)器上建立鏡像,否則將依法追究法律責(zé)任。本站部分內(nèi)容來源于網(wǎng)友推薦、互聯(lián)網(wǎng)收集整理而來,僅供學(xué)習(xí)參考,不代表本站立場,如有內(nèi)容涉嫌侵權(quán),請聯(lián)系alex-e#qq.com處理。
相關(guān)文章