一、安装docker及下载nginx
docker安装步骤请参考:https://blog.youkuaiyun.com/wugenqiang/article/details/86513257
二、配置文件服务器:
mkdir -p /root/file
1、进入容器
docker exec -it nginx /bin/bash
2、修改nginx配置文件(复制如下指令在docker shell终端中执行)
echo -e "server { \n\
listen 80; \n\
server_name localhost; \n\
location / { \n\
autoindex on; \n\
autoindex_exact_size off; \n\
autoindex_localtime on; \n\
charset utf-8; \n\
root /var/www; \n\
index index.html index.htm; \n\
} \n\
error_page 500 502 503 504 /50x.html; \n\
location = /50x.html { \n\
root /var/wwwl; \n\
} \n\
} " > /etc/nginx/default.conf
3、重启容器
docker restart nginx
4、校验(开浏览器 http://你的IP/)