Keycloak integration: Part 1: Nginx and Keycloak(proxy) deployment
Integrating the Keycloak as a reverse-proxy server in our webserver of Nginx can be a useful setup. There are other blogs on this but I faced lots of challenges in setting the Keycloak in the desired way, so writing this blog series where I go through setting Keycloak with different types of clients in Realm this is First Part of the series and this to deploying Keycloak with Nginx Webserver.
In this blog we will be setting the Keycloak and Nginx in the following way:

Keycloak server deployment and configuration with PostgreSQL
Note:
1. Create the respective docker network and volume for the services.
2. Keycloak service:
2.1. You can also use schema base table creation with PostgreSQL (you also need to update your database also "CREATE SCHEMA kc_model;") and update the environment variable like-
DB_SCHEMA: kc_model
2.2. You can further define your frontend-URL for admin console or also pass using the environment variable like-
KEYCLOAK_FRONTEND_URL: https://keycloak.yourdomain.com/auth
2.3 JDBC Params can also be added this will be appended to Keycloak’s DB-connection URL below is the log output from Keycloak:
"connection-url" => expression "jdbc:postgresql://${env.DB_ADDR:postgres}/${env.DB_DATABASE:keycloak}${env.JDBC_PARAMS:}"
Use below docker-compose file for managing Keycloak, PostgreSQL, and Nginx
Also, add the webserver_nginx.conf file, update the path in docker-compose if required assuming it to be in same directory with compose file.
Further, you need to add the SSL certificate data to the /config/cert location.
Further to remove the containers, volumes and network follow
docker-compose -f docker-compose-kc-psql-nginx.yml down
docker volume rm psql_storage
docker network rm my-net
# and the downloaded file
Conclusion:
By the above setup now we can reverse proxy our Keycloak server and this can be accessed by domain.com/auth .
PS: More parts will be added to this Keycloak Integration blog series.
Happy Coding. 👨💻