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://;
    }
}
相关推荐
牛奶10 小时前
HTTPS你不知道的事
前端·https·浏览器
extrao1 天前
🚀 Kea DHCP4 自动分配系统完整搭建
网络协议
喵个咪2 天前
Go-Wind HTTP 服务器从入门到精通
后端·http·go
不做菜鸟的网工3 天前
BGP特性
网络协议
AlfredZhao4 天前
生产环境里,为什么不建议把普通端口直接暴露到公网?
linux·https·443·80
明月_清风5 天前
开发者网络概念全扫盲:一篇搞定
后端·网络协议
刘马想放假6 天前
Modbus 全栈技术解析:TCP、RTU、ASCII、RTU over TCP
数据结构·网络协议
王二端茶倒水7 天前
一套可落地的无线运营方案,不能只管 AP,还要管用户、计费和运维
网络协议
162723816087 天前
EtherCAT 分布式时钟(DC)原理与配置实战:把多轴真正"对齐到同一时刻"
网络协议
王二端茶倒水7 天前
宽带无线项目,怎么从一次性交付变成长期运营收入?
网络协议