Docker安装ShowDoc ssl https nginx配置
一、docker安装showdoc
1、拉取镜像
# 中国大陆镜像安装命令(安装后记得执行docker tag命令以进行重命名)
docker pull registry.cn-shenzhen.aliyuncs.com/star7th/showdoc
docker tag registry.cn-shenzhen.aliyuncs.com/star7th/showdoc:latest star7th/showdoc:latest
2、创建showdoc数据目录
mkdir -p /mydata/showdoc/showdoc_data/html
chmod -R 777 /mydata/showdoc/showdoc_data
3、启动容器
docker run -d --name showdoc --user=root --privileged=true -p 4999:80 \
-v /mydata/showdoc/html:/var/www/html/ star7th/showdoc
4、设置随容器启动
docker update --restart=always showdoc
此时旧可以通过IP+port访问了,注意,端口放行,云服务器白名单开启。
二、showdoc配置https、ssl、nginx配置
nginx https、ssl配置如下:
server {
listen 443 ssl;
server_name doc.yanxizhu.com;
client_max_body_size 1000m;
ssl on;
ssl_certificate /etc/nginx/conf.d/key/doc.yanxizhu.com_bundle.crt;
ssl_certificate_key /etc/nginx/conf.d/key/doc.yanxizhu.com.key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 10m;
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 ^~ / {
proxy_pass http://自己云服务器ip:4999/;
proxy_redirect off;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header http_user_agent $http_user_agent;
}
}
server {
listen 80;
server_name doc.yanxizhu.com;
rewrite ^(.*) https://doc.yanxizhu.com$1 permanent;
}
注意:修改自己域名和对应端口。
此时就可以通过域名https://doc.yanxizhu.com/访问了。
评论 (0)