1-Nginx做底座
在模板之家下载静态网页-上传到服务器上
1、先运行nginx
docker run -d --name nginx nginx
2、进入运行的nginx,将nginx的配置保存到指定的目录
docker container ls (查看nginx的containerID)
export NGINX_PATH=/apps/config/nginx
mkdir -p $NGINX_PATH/conf (创建自己的nginx配置目录)
mkdir -p $NGINX_PATH/html
#mkdir -p $NGINX_PATH/conf/nginx.conf
docker cp 43b9e86346b4aa2ed9:/etc/nginx/nginx.conf $NGINX_PATH/conf
如果不更改,访问403权限拒绝
chmod -R 755 $NGINX_PATH
3、停止nginx镜像(运行的目的是拷贝nginx配置信息)
docker container stop 43b9e86346b4aa2ed9
docker container rm 43b9e86346b4aa2ed9
4、修改相关的本地配置
vim $NGINX_PATH/conf/nginx
5、添加主页展示页面
echo "hello">$NGINX_PATH/html/index.html
6、运行挂载我们自己的配置文件
docker run -d -p 80:80 --name nginx-station-80 -v /root/html/html_template_train:/usr/share/nginx/html -v $NGINX_PATH/conf/nginx.conf:/etc/nginx/nginx.conf -v $NGINX_PATH/logs:/var/log/nginx nginx











网友评论