How to enabling HTTPS for keycloak behind nginx - Stack Overflow

admin2025-04-19  0

I’m running Keycloak in a Docker container and have set up an Nginx reverse proxy to make it accessible at docsbot.agency. My current setup allows access via HTTP, but I need to enable HTTPS using an SSL certificate I have for the domain.

Currently, I launch Keycloak with the following command:

sudo docker run -d -p 8000:8080 \
    -e KC_BOOTSTRAP_ADMIN_USERNAME=admin \
    -e KC_BOOTSTRAP_ADMIN_PASSWORD=admin \
    quay.io/keycloak/keycloak:26.0.7 start-dev

My Nginx configuration is as follows:

server {
    listen 80;
    server_name docsbot.agency;

    location / {
        proxy_pass http://127.0.0.1:8000;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

How can I modify my setup to correctly enable HTTPS? Should I configure Keycloak differently, or should I handle it entirely through Nginx?

Any guidance would be much appreciated!

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1745041485a281567.html

最新回复(0)