keycloak 11.0.2 版本使用https

生成 SSL 证书

生成私钥:

bash 复制代码
openssl genpkey -algorithm RSA -out privateKey.pem -pkeyopt rsa_keygen_bits:2048

生成证书签名请求 (CSR):

bash 复制代码
openssl req -new -key privateKey.pem -out certificate.csr

生成自签名证书:

bash 复制代码
openssl x509 -req -days 365 -in certificate.csr -signkey privateKey.pem -out certificate.crt

配置 Nginx 代理

bash 复制代码
server {
    listen 8080;
    listen 443 ssl;
    server_name localhost;
    
    ssl_certificate certificate.crt;
    ssl_certificate_key privateKey.pem;
    ssl_session_timeout 5m;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers on;
    
    location / {
        proxy_pass http://keycloak.demofor.cn:8080;
        proxy_set_header Host $host:$server_port;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-Port $server_port;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_redirect http://$scheme://;
    }
}
相关推荐
cur1es1 小时前
【UDP的报文结构】
网络·网络协议·udp·md5
闲人编程2 小时前
使用FastAPI和WebSocket构建高性能实时聊天系统
websocket·网络协议·网络编程·fastapi·持久化·实时聊天·codecapsule
惊讶的猫2 小时前
OpenFeign(声明式HTTP客户端)
网络·网络协议·http·微服务·openfeign
心.c2 小时前
TCP协议深入解析
网络·网络协议·tcp/ip
摇滚侠3 小时前
HTTP 404 - No response body available
网络·网络协议·http
全栈工程师修炼指南3 小时前
Nginx | stream content 阶段:TCP 协议四层反向代理浅析与实践
运维·网络·网络协议·tcp/ip·nginx
Trouvaille ~3 小时前
【Linux】应用层协议设计实战(一):自定义协议与网络计算器
linux·运维·服务器·网络·c++·http·应用层协议
任白4 小时前
OSI参考模型&&TCP/IP模型
网络协议
不做菜鸟的网工4 小时前
OSPF协议笔记整理
网络协议
tzy2336 小时前
极简版本的 TCP / IP 协议栈介绍
网络·网络协议·tcp/ip