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 OS X

Attila Levente EGYEDI edited this page Apr 6, 2017 · 5 revisions

Backup the existing Nginx configuration

cp $NGINX_HOME/nginx.conf $NGINX_HOME/nginx.conf.backup

Edit the existing configuration file

vi $NGINX_HOME/nginx.conf

Replace all the content with the following:

worker_processes  1;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;

    keepalive_timeout  65;
    
    include cedar/*.inc.conf;
}

Create a subfolder for cedar specific configs

mkdir $NGINX_HOME/cedar
mkdir $NGINX_HOME/cedar/ssl

Create a new CEDAR specific configuration file

sudo vi $NGINX_HOME/cedar/cedar-main.inc.conf

Add the below content to the 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.metadatacenter.orgx;
  location / {
      proxy_pass http://cedar-backend-auth-http;
  }
}

If Nginx is running, stop it:

sudo nginx -s stop 

Then restart it:

sudo nginx
Clone this wiki locally