docker nginx

需要一个 autoindex 的 www。先建立一个 guoshuang_labs.conf

1
2
3
4
5
6
7
8
9
10
server {
listen 80;
server_name labs.guoshuang.com;
charset utf-8;
index index.html index.htm index.php;
root /usr/share/nginx/html/guoshuang_labs/;
location / {
autoindex on;
}
}

然后 copy 到 docker nginx 容器

1
docker cp guoshuang_labs.conf nginx:/etc/nginx/conf.d/guoshuang_labs.conf

重启

1
docker retart nginx

更多参考


1
2
3
4
5
6
# 查找镜像
docker search nginx
# 拉取镜像
docker pull nginx
# 查看本地镜像
docker images
1
docker cp nginx:/etc/nginx/conf.d/guoshuang_demo.conf guoshuang_demo.conf

进入容器

1
docker exec -it nginx bash