使用Docker安装的nginx配置HTTPS证书
新建ssl.conf,将文件放入conf.d文件夹中
server {
listen 443;
server_name localhost;
ssl on;
root html;
index index.html index.htm;
ssl_certificate cert/1533224843981.pem;
ssl_certificate_key cert/1533224843981.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;
location / {
root html;
index index.html index.htm;
}
}
- 注意点:cert为相对路径,若是linux文件夹与nginx.conf,若是window则在conf文件夹下。
运行
docker run --name mynginx -p 443:443 -v /opt/data/nginx/nginx.conf:/etc/nginx/nginx.conf
-v /opt/data/nginx/conf.d:/etc/nginx/conf.d/default.conf
-v /opt/data/nginx/www:/www -v /opt/data/nginx/cert:/etc/nginx/cert
-v /opt/data/nginx/ssl.conf:/etc/nginx/conf.d/ssl.conf -d nginx
本文标题:使用Docker安装的nginx配置HTTPS证书
本文链接:https://www.haomeiwen.com/subject/ceeibftx.html
网友评论