centos7 docker安装nginx

1、查询nginx最新镜像

     docker search nginx

 

 

2、下载镜像

   docker pull nginx

 

 

3、创建目录

mkdir -p /software/nginx/html

mkdir -p /software/nginx/conf

mkdir -p /software/nginx/logs

4、创建config.conf文件,部分配置

 

 创建index.html

 

 

 

 

5、运行镜像

docker run -d -p 80:80 \

--name nginx \

-v /software/nginx/html:/etc/nginx/html \

-v /software/nginx/conf:/etc/nginx \

-v /software/nginx/conf/nginx.conf:/etc/nginx/nginx.conf \

-v /software/nginx/logs:/etc/nginx/logs \

nginx

 

6、页面效果

 

 

 

 

posted @ 2019-11-26 14:13  桥头堡洗脚城  阅读(122)  评论(0编辑  收藏