https的配置和使用(以腾讯云为例)

1、注册域名

2、获取证书

3、下载证书

下载下来的证书所有格式

4、在服务器上下载nginx并配置

nginx的配置文件 如下

java 复制代码
server {
    listen       80;
    listen       443 ssl;
    server_name  delegate.letspiu.net.cn;

    ssl on; #开启ssl
    #指定证书位置
    ssl_certificate         /etc/ssl/certs/letspiu.net.cn_bundle.pem;
    ssl_certificate_key     /etc/ssl/certs/letspiu.net.cn.key;

     ssl_session_cache shared:SSL:1m;
     ssl_session_timeout 5m;
     #ssl_ciphers HIGH:!aNULL:!MD5;
     ssl_prefer_server_ciphers on;
     #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协议
     #重定向请求
    location / {
        proxy_http_version 1.1; #代理使用的http协议
        proxy_pass http://127.0.0.1:8090;

    }
}
docker-compose的配置
java 复制代码
nginx:
    container_name: nginx
    network_mode: host
    image: "9a53df624b74"
    deploy:
      resources:
        limits:
          cpus: '0.5'
          memory: 2048M
    volumes:
      - ./nginx/www:/var/www
      - ./nginx/logs:/var/log/nginx
      - ./nginx/cert:/etc/nginx/cert
      - ./nginx/conf.d:/etc/nginx/conf.d

特别注意、特别注意、特别注意、特别注意、特别注意、特别注意

在使用https请求时,会有证书不安全的问题,

原因 原因 原因 原因

是因为配置证书时绑定的域名,只支持www.或者原始域名 如下:

只有这里显示的域名配置在nginx使用https显示才是安全的。

相关推荐
程序员小单13 分钟前
WebSocket 与 Spring Boot 整合实践
spring boot·websocket·网络协议
游戏开发爱好者83 小时前
Mac 抓包软件怎么选?从 HTTPS 调试、TCP 数据流分析到多工具协同的完整抓包方案
tcp/ip·macos·ios·小程序·https·uni-app·iphone
海域云-罗鹏5 小时前
电商掘金日本:SDWAN专线刚需原因
服务器·网络·网络协议
翻斗花园正门保安小夏5 小时前
HTTPS + WSS(WebSockets) 完整请求流程架构说明及本地开启HTTPS
websocket·网络协议·https
2501_915918416 小时前
苹果上架 iOS 应用的工程实践,一次从零到上线的完整记录
android·ios·小程序·https·uni-app·iphone·webview
发光小北7 小时前
SG-TCP-Profibus (M)(ModbusTCP 转 Profibus DP 网关)
网络·网络协议·tcp/ip
Arva .7 小时前
TCP 与 UDP 的 10 大核心区别是什么?
网络协议·tcp/ip·udp
2501_915918418 小时前
如何解析iOS崩溃日志:从获取到符号化分析
android·ios·小程序·https·uni-app·iphone·webview
重启的码农8 小时前
enet源码解析 (2) 对等节点 (ENetPeer)
c++·网络协议
发光小北9 小时前
SG-TCP-COE-210(Modbus TCP 转 CANOpen 网关)
网络·网络协议·tcp/ip