Sign inSign up

ykfq/nginx-with-https

By ykfq

•Updated almost 9 years ago

Nginx docker image of my blog with https

Image
0

908

ykfq/nginx-with-https repository overview

⁠1. commit an exsiting container as an image:

docker commit nginx ykfq/nginx-with-https:1.0.0

⁠2. login the docker hub

docker login -u ykfq -p xxxxx

⁠3. push the image to docker hub

docker push ykfq/nginx-with-https:1.0.0

⁠4. pull this image to other host and run it

docker pull ykfq/nginx-with-https docker run -itd --name nginx -p 80:80 -p 443:443 -v /data/nginx/:/data/nginx/ ykfq/nginx-with-https bash

⁠5.nginx.conf
server {
    listen 80;
    server_name www.ykfq.me ykfq.me;
    client_max_body_size 50M;
    access_log /var/log/nginx/www.ykfq.me.access.log main;
    error_log /var/log/nginx/www.ykfq.me.error.log warn;
    return 301 https://www.ykfq.me;
    }

server {
    listen 443;
    charset utf-8;
    client_max_body_size 2048M;
    server_name www.ykfq.me;
    ssl on;
    ssl_certificate      /data/nginx/conf/ssl/www.ykfq.me.pem;
    ssl_certificate_key  /data/nginx/conf/ssl/www.ykfq.me.key;
    ssl_session_timeout 5m;
    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers on;

    access_log /data/nginx/log/ykfq.me.access.log main;
    error_log /data/nginx/log/ykfq.me.error.log debug;

    location / {
          proxy_set_header X-Real-IP $remote_addr;
          proxy_set_header Host $host;
          proxy_set_header X-Forwarded-For $remote_addr;
          proxy_set_header X-Forwarded-Proto https;
          proxy_connect_timeout    600;
          proxy_read_timeout       600;
          proxy_send_timeout       600;
          proxy_pass http://172.18.0.5:80;
    }

    location /download {
         root /data/nginx/;
         autoindex on;
         autoindex_exact_size off;
         autoindex_localtime on;
    }

} #End server


Tag summary

Content type

Image

Digest

Size

70.3 MB

Last updated

almost 9 years ago

docker pull ykfq/nginx-with-https