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://;
    }
}
相关推荐
pcplayer1 小时前
Delphi WebService 使用 HTTP Header 管理 Session
http·webservice·soap·web server·http header
微硬创新2 小时前
大点数模拟量采集落地:耐达讯自动化32路0-20mA适配PROFINET总线实践解析
运维·人工智能·网络协议·自动化·信息与通信
游戏开发爱好者83 小时前
iOS 推送怎么配置,APNs 推送证书、设备库与群发
android·ios·小程序·https·uni-app·iphone·webview
小新讲网安3 小时前
HTTP请求走私攻击实战:CL.TE与TE.CL绕过前端服务器全解析
服务器·前端·网络·web安全·http·架构·漏洞
zhengqiqiqinqin3 小时前
Ubuntu16.04 升级ssl到3.5.7、升级ssh到9.8p1
网络协议·ssh·ssl
wear工程师21 小时前
接口超时别只调大 timeout:Java HTTP 客户端其实有 3 段等待
java·http
蜡台21 小时前
本机 局域网 搭建本地 HTTPS 域名完整方案
网络协议·http·https·openssl
Alkaid20771 天前
为什么查 IP 有两个结果?这个问题问倒过多少人
网络协议·tcp/ip
LCG元1 天前
ESP32-IDF 远程固件升级实战:HTTPS OTA + 双分区切换 + 自动回滚
数据库·redis·https
ControlRookie1 天前
第13篇_Client 02|TCP 连接成功,为什么 HTTP 请求还没有成功
http·codesys·plc通信·controlrookie