首页 > 编程知识 正文

docker搭建elasticsearch集群,docker和linux搭建网站的区别

时间:2023-05-03 05:57:19 阅读:259954 作者:4299

Docker Wnmp 搭建 1.下载Docker for windows2.通过power shell 拉取镜像3.启动指定 镜像的容器4.拷贝对应的挂载目录及文件5.default.conf文件配置

1.下载Docker for windows

https://hub.docker.com/editions/community/docker-ce-desktop-windows

2.通过power shell 拉取镜像 docker pull mysql:5.6 docker pull php:7.1 docker pull nginx:1.10.3 3.启动指定 镜像的容器 docker run -d -v E:wnmpmysql-log:/var/log/mysql/ -v E:wnmpmysql-conf:/etc/mysql/ -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 --name mysql mysql:5.6 docker run -d -v E:wnmpphp71-log:/usr/local/var/log -v E:wnmpwww:/var/www -p 9000:9000 --link mysql:mysql --name php71 php:7.1-fpm docker run -d -p 80:80 -v E:wnmpwww:/var/www -v E:wnmpnginx-log:/var/log/nginx/ --name nginx nginx:1.10.3 docker run 命令解释 -d: 后台运行容器,并返回容器ID; -p: 指定端口映射,格式为:主机(宿主)端口:容器端口; --volume , -v: 绑定一个卷 -e username="ritchie": 设置环境变量; --link=[]: 添加链接到另一个容器;

详细:https://www.runoob.com/docker/docker-run-command.html

4.拷贝对应的挂载目录及文件 docker cp mysql:/var/log/mysql/ E:wnmpmysql-log docker cp mysql:/etc/mysql/ E:wnmpmysql-conf docker cp php71:/usr/local/var/log E:wnmpphp71-log docker cp php71:/var/www/html E:wnmpwww docker cp nginx:/var/log/nginx/ E:wnmpnginx-log docker cp nginx:/var/www/html E:wnmpwww 将配置文件拷贝出来 docker cp nginx:/etc/nginx/conf.d/default.conf E:wnmpwwwdefault.conf 修改完拷贝回去 docker cp E:wnmpwwwdefault.conf nginx:/etc/nginx/conf.d/default.conf 5.default.conf文件配置 server { listen 80; server_name localhost; #charset koi8-r; #access_log /var/log/nginx/log/host.access.log main; location / { root /var/www; index index.php index.html index.htm; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ .php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ .php$ { root /var/www; fastcgi_pass 192.168.11.133:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /var/www/$fastcgi_script_name; include fastcgi_params; } # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /.ht { # deny all; #}}

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。