×

docker

96
梁同桌
2018.05.19 14:59* 字数 5

自己
nginx 配置

启动
docker container run \
  -d \
  -p 80:80 \
  -p 443:443 \
  --rm \
  --name mynginx \
  --volume /home/ubuntu/code/:/usr/share/nginx/html\
  --volume /home/ubuntu/nginx_conf:/etc/nginx \
  nginx

参数解释
-d:在后台运行
-p :本地 80 端口-容器的 80 端口
--rm:容器停止运行后,自动删除容器文件
--name:容器的名字为mynginx
--volume:本地文件-容器文件

停止
docker container stop mynginx

进入 docker 
docker container ls
docker exec -it d48b21a7e439 /bin/sh

  server {
               listen          80;
               server_name     "www.liangtongzhuo.com";
               location / {
        root   /usr/share/nginx/html/blog;
        index  index.html index.htm;
    }
    }


server {
    listen 443 ssl http2;
    server_name  localhost;

    ssl                      on;
    ssl_certificate          /etc/nginx/ssl/Nginx/1_www.liangtongzhuo.com_bundle.crt;
    ssl_certificate_key      /etc/nginx/ssl/Nginx/2_www.liangtongzhuo.com.key;

    ssl_session_timeout  5m;

    ssl_ciphers HIGH:!aNULL:!MD5;
    ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers   on;

    location / {
        root   /usr/share/nginx/html/blog;
        index  index.html;
    }
}
Liunx
Web note ad 1