docker镜像发布的应用程序,其配置https的流程

news/2025/3/16 3:43:15/

1、docker启动命令:将443端口映射出来,其中注意 /root/app/nginx/ai-ssl(证书存放路径)、/data/app/ai-nginx/nginx.conf(nginx的配置路径)
docker run -d --restart=always -p 12324:80 -p 8443:443 -v /root/app/nginx/ai-ssl:/etc/ssl/agent -v /data/app/ai-nginx/nginx.conf:/etc/nginx/nginx.conf registry.cn-hangzhou.aliyuncs.com/suqinghua/ai-web:0.0.1
2、配置 /data/app/ai-nginx/nginx.conf文件,暴露443端口:

server {listen       443 ssl;server_name  localhost;add_header X-Frame-Options DENY;  # 可以根据需求选择 DENY、SAMEORIGIN 或 ALLOW-FROMssl_certificate /etc/ssl/agent/ca.crt;  #证书路径及文件名ssl_certificate_key /etc/ssl/agent/ca.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;add_header Permissions-Policy "microphone=*" always;#add_header Feature-Policy "microphone *" always;location / {root   /home/nginx/www/dist/digital-web;try_files $uri $uri/ /index.html;index  index.html index.htm;}location /prod-api/{proxy_cache off; # 转发流式数据proxy_buffering off;chunked_transfer_encoding on;tcp_nopush on;tcp_nodelay on;keepalive_timeout 300;proxy_set_header Host $http_host;proxy_set_header X-Real-IP $remote_addr;proxy_set_header REMOTE-HOST $remote_addr;proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;proxy_set_header X-Forwarded-Scheme $scheme;  # 关键:透传HTTPS协议proxy_pass http://ip:38081/;}location /profile/{proxy_set_header Host $http_host;proxy_set_header X-Real-IP $remote_addr;proxy_set_header REMOTE-HOST $remote_addr;proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;proxy_set_header X-Forwarded-Scheme $scheme;  # 关键:透传HTTPS协议proxy_pass http://ip:38081/profile/;}error_page   500 502 503 504  /50x.html;location = /50x.html {root   html;}}

3、将证书放置 /root/app/nginx/ai-ssl路径下,如下:

root@ssdmx62:~/app/nginx/aihd-ssl# ls
ca.crt  ca.key

需要注意的是,文件名要与nginx中的文件名对应(下列代码出现在步骤二中的nginx.conf文件):

    ssl_certificate /etc/ssl/agent/ca.crt;ssl_certificate_key /etc/ssl/agent/ca.key;

4、下面就可以通过域名:8443访问应用。


http://www.ppmy.cn/news/1579475.html

相关文章

电脑实用小工具--VMware常用功能简介

一、创建、编辑虚拟机 1.1 创建新的虚拟机 详见文章新创建虚拟机流程 1.2 编辑虚拟机 创建完成后,点击编辑虚拟机设置,可对虚拟机内存、处理器、硬盘等各再次进行编辑设置。 二、虚拟机开关机 2.1 打开虚拟机 虚拟机创建成功后,点击…

zsh: command not found: adb 报错问题解决

哈喽小伙伴们大家好,我是小李,今天,我满怀信心想要在本地跑一下pda,然而, what? 居然报错了!!别逗我啊! 好吧,究其原因:没有配置好sdk 那就配呗。 首先,…

Ubuntu 配置 github 代理

参考:虚拟机 ubuntu 20.04 git 设置代理的方法_ubuntu_张世争-华为开发者空间 (csdn.net) 查看 Windows 的 IP,例如:192.168.10.100 然后回到 ubuntu 中 git config --global https.proxy https://192.168.10.100:7890 git config --global …

【数据结构】-哈夫曼树以及其应用

哈夫曼树(Huffman Tree) 1. 哈夫曼树的定义 哈夫曼树(Huffman Tree)是一种 带权路径长度最短的二叉树,常用于数据压缩和最优前缀编码。其目标是使得 带权路径长度(WPL)最小。 在信息论和计算…

leetcode top100矩阵题73.54.48.240

73. 矩阵置零 class Solution {public void setZeroes(int[][] matrix) {int line matrix.length;int col matrix[0].length;List<Integer> changeLines new ArrayList<Integer>();List<Integer> changeCols new ArrayList<Integer>();for(int i …

JavaScript性能优化

JavaScript性能优化指南 一&#xff1a;性能分析与指标确立 使用性能分析工具 • 使用Lighthouse、Chrome DevTools的Performance面板和WebPageTest进行基准测试&#xff0c;识别加载时间、脚本执行时长等瓶颈。 • 关注核心Web指标&#xff1a;LCP&#xff08;最大内容绘制&a…

pytorch训练权重转化为tensorflow模型的教训

模型构建时候有时候在工程量比较大的时候&#xff0c;不可避免使用迭代算法&#xff0c;迭代算法本身会让错误的追踪更加困难&#xff0c;因此掌握基本的框架之间的差异非常重要。以下均是在模型转换过程中出现的错误。 shuffle operation(shuffle 操作) 这个操作原本是用来将…

HTML 样式之 CSS 全面解析

在网页开发的世界里&#xff0c;HTML 负责搭建页面的结构&#xff0c;而 CSS&#xff08;Cascading Style Sheets&#xff0c;层叠样式表&#xff09;则承担着渲染 HTML 元素标签样式的重任&#xff0c;赋予网页丰富的视觉效果。​ 一、CSS 的魅力展现​ CSS 能够实现诸如改变…