从腾讯云下载nginx版本证书
由于nginx在docker中安装的,所以我们需要开启80端口和443端口映射。
docker nginx 安装
docker pull nginx
docker run --rm --name nginx1 -p 80:80 -d nginx
docker cp nginx1:/etc/nginx/nginx.conf /data/nginx/conf/
docker stop nginx1
docker run -idt -p 80:80 -p 443:443 --name nginx1 \
-v /data/nginx/dist:/usr/share/nginx/html \
-v /data/nginx/conf/nginx.conf:/etc/nginx/nginx.conf \
-v /data/nginx/logs:/var/log/nginx nginx \;
nginx 配置https
server {
listen 443 ssl;
server_name www.heidaotu.cn;
ssl_certificate /usr/share/nginx/html/heidaotu.cn_nginx/heidaotu.cn_bundle.crt;
ssl_certificate_key /usr/share/nginx/html/heidaotu.cn_nginx/heidaotu.cn.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
ssl_prefer_server_ciphers on;
root /usr/share/nginx/html/facebook;
location / {
root /usr/share/nginx/html/facebook;
index index.html index.htm;
}
}
然后重启 docker restart nginx1.
查看效果
|