Riguz留言 | 贡献
标签2017版源代码编辑
Riguz留言 | 贡献
第1行: 第1行:
== Install ==
== Install ==
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
docker run --name example-keycloak \
docker run --name example-keycloak \
   -p 8081:8080 -d \
   -p 8081:8080 -d \
   -e KC_BOOTSTRAP_ADMIN_USERNAME=admin \
   -e KC_BOOTSTRAP_ADMIN_USERNAME=admin \
   -e KC_BOOTSTRAP_ADMIN_PASSWORD=<change it> \
   -e KC_BOOTSTRAP_ADMIN_PASSWORD=<change it> \
   quay.io/keycloak/keycloak:26.0.7 start-dev \
   quay.io/keycloak/keycloak:26.3.2 start-dev \
   --hostname=https://oauth.example.com
   --hostname=https://oauth.example.com
</syntaxhighlight>
</syntaxhighlight>

2025年8月6日 (三) 01:22的版本

Install

docker run --name example-keycloak \
  -p 8081:8080 -d \
  -e KC_BOOTSTRAP_ADMIN_USERNAME=admin \
  -e KC_BOOTSTRAP_ADMIN_PASSWORD=<change it> \
  quay.io/keycloak/keycloak:26.3.2 start-dev \
  --hostname=https://oauth.example.com

Reversed proxy[1] [2]:

server {

    server_name oauth.example.com;

    location / {
        root   html;
        index  index.html index.htm;
        proxy_pass  http://localhost:8081;

	       proxy_redirect off;
           proxy_set_header Host $host;
           proxy_set_header X-Real-IP $remote_addr;
           proxy_set_header X-Forwarded-For $remote_addr;
           proxy_set_header X-Forwarded-Proto $scheme;
           proxy_set_header X-Forwarded-Port 443;
    }
    ...
}

Configure

  • Create realm: my-org
  • Create users: whatever
  • Create client: my-app