docker安装Nginx | 您所在的位置:网站首页 › 陌上烟雨情侣名下一句 › docker安装Nginx |
文章目录 一、docker 安装nginx 二、安装步骤 1.docker 拉取nginx镜像 2.启动nginx容器 3.映射相关配置文件到宿主主机 3.docker启动nginx镜像映射宿主主机配置文件 总结 一、docker 安装nginx Nginx 是一个高性能的 HTTP 和反向代理 web 服务器,同时也提供了 IMAP/POP3/SMTP 服务 。 二、安装步骤 1.docker 拉取nginx镜像 代码如下(示例): docker pull nginx 2.启动nginx容器 代码如下(示例): docker run –name nginx-test -p 8080:80 -d nginx 3.映射相关配置文件到宿主主机 在opt下新建项目demo,在demo下新建nginx文件夹,在nginx下新建conf.d、conf、html和logs文件夹 复制nginx配置文件到宿主主机 docker cp nginx-test:/etc/nginx/conf.d /opt/demo/nginx 2.docker cp nginx-test:/etc/nginx/nginx.conf /opt/demo/nginx/conf 3.docker启动nginx镜像映射宿主主机配置文件 启动是映射好相关配置文件路径 docker run –name nginx-test -p 8080:80 -v /opt/demo/nginx/html:/usr/share/nginx/html -v /opt/demo/nginx/conf/nginx.conf:/etc/nginx/nginx.conf -v /opt/demo/nginx/logs:/var/log/nginx -v /opt/demo/nginx/conf.d:/etc/nginx/conf.d -d nginx (这里代码太多了我就不发图片了) 总结 nginx通过docker容器进行隔离,修改配置文件更加精准快速的找到我们想要修改的配置文件。 看完记得点赞加关注(“不给点赞?”) 原文链接:https://blog.csdn.net/2301_77296775/article/details/130005161 |
CopyRight 2018-2019 实验室设备网 版权所有 |