Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

Configure NginX for Keycloak on RHEL 6.6

Martin O'Connor edited this page Apr 12, 2016 · 11 revisions

Backup the existing Nginx configuration:

sudo cp $NGINX_HOME/conf.d/default.conf $NGINX_HOME/conf.d/default.conf.backup

Edit the configuration file:

sudo vi $NGINX_HOME/conf.d/default.conf

Add the content below before the existing server block:

Note: This content is included in the http block of the main configuration file.

proxy_http_version 1.1; # this is essential for chunked responses to work
proxy_buffering    off;
proxy_set_header   X-Real-IP $remote_addr;
proxy_set_header   X-Scheme $scheme;
proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header   Host $http_host;

upstream cedar-backend-auth-http {
  server 127.0.0.1:8080;
}

server {
  listen              80;
  server_name         auth.<HOSTNAME>; # Replace <HOSTNAME> with the current host!!!
  location / {
      proxy_pass http://cedar-backend-auth-http;
  }
}

Replace the <HOSTNAME> in the server_name with the host, e.g.,

auth.staging.metadatacenter.net

Restart Nginx:

sudo service nginx restart
Clone this wiki locally