雪之梦技术驿站
  • Summary
  • Tips
  • 运维部署
    • docker-advance
    • docker + Bark
    • docker + blog
    • docker compose
    • docker + crawlab
    • docker + email
    • docker 环境
    • docker + gitbook
    • docker + gitea
    • docker + gitlab
    • docker + gogs
    • docker + mojo-Weixin
    • docker + mysql
    • docker + nginx
    • docker 操作
    • docker + py12306
    • docker + redis
    • docker + resume
    • docker + springboot
    • docker + wechat-work-message-push-go
  • git
    • git 入门教程
    • base
      • 初识 git
      • 配置 git
      • 安装 git
  • github
    • github 入门教程
  • 晚安
  • markdown
    • README_update
  • todo
    • github 快速入门
    • android studio 快速入门
    • gitignore 快速入门
    • gulp快速入门
    • java 快速入门
    • lodash快速入门
    • maven 快速入门
    • mysql 快速入门
    • nginx 快速入门
    • npm 快速入门
    • nvm快速入门
    • regexper快速入门
    • sublime快速入门
    • svn 快速入门
    • tomcat 快速入门
    • yarn快速入门
  • write
    • 快速上手Mermaid流程图
  • gitbook
    • gitbook-plugin-advanced-emoji
      • LICENSE-IMAGES
      • LICENSE
Powered by GitBook
On this page
  • docker
  • 部署到 nginx
  • 实际情况
  • 参考资料

Was this helpful?

  1. 运维部署

docker + gitbook

docker

  • 搜索镜像

docker search nginx
  • 列出镜像

docker images
  • 下载镜像

docker pull nginx
  • 运行容器

docker ps
  • 启动容器

docker run --name nginx-test -p 80:80 -d nginx

部署到 nginx

  • 服务器创建 nginx 文件

mkdir -p ~/nginx/www ~/nginx/conf ~/nginx/logs
  • 拷贝到容器内部

docker cp 6dd4380ba708:/etc/nginx/nginx.conf ~/nginx/conf
  • 部署 nginx

docker run -d -p 80:80 --name blob.snodreams1006.cn -v ~/nginx/www:/usr/share/nginx/html -v ~/nginx/conf/nginx.conf:/etc/nginx/nginx.conf -v ~/nginx/logs:/var/log/nginx nginx
  • 重新载入 nginx

docker kill -s HUP container-name
  • 重启 nginx 容器

docker restart container-name

实际情况

  • 安装 tree

yum install -y tree
  • 启动容器

docker run --name blob.snodreams1006.cn -p 80:80 -d nginx
  • 拷贝到容器内部

docker cp 6af3f4d1911c:/etc/nginx/nginx.conf ~/nginx/conf
  • 停止容器

docker stop blob.snodreams1006.cn
  • 上传服务器

scp -r /Users/snowdreams1006/Documents/workspace/snowdreams1006.github.io/_book/* root@121.40.223.69:~/nginx/www
  • 部署 nginx

docker run -d -p 80:80 --name blob.snowdreams1006.cn -v ~/nginx/www:/usr/share/nginx/html -v ~/nginx/conf/nginx.conf:/etc/nginx/nginx.conf -v ~/nginx/logs:/var/log/nginx nginx

参考资料

Previousdocker 环境Nextdocker + gitea

Last updated 9 months ago

Was this helpful?

Docker 安装 Nginx
检查TCP 80端口是否正常工作
安全组应用案例
Docker 安装 Nginx
Mac/Linux/Centos终端中上传文件到Linux云服务器