How to configure saml 2.0 in nginx server?

Posted December 13, 2019 14.6k views
NginxNode.jsDebian 9

How can I configure saml 2.0 in nginx, if I have only .cert file and .xml file?

Below are my nginx server configuration

  1. /etc/nginx/nginx.conf
user  nginx;
worker_processes  auto;

error_log  /var/log/nginx/error.log warn;
pid        /var/run/;

events {
    worker_connections  1024;

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

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;

    #gzip  on;

    include /etc/nginx/conf.d/*.conf;

  1. /etc/nginx/conf.d/default.conf file
server {
    server_name < hostname >;

    #charset koi8-r;
    #access_log  /var/log/nginx/host.access.log  main;

    location / {
    root   /var/www/html;
        index  index.html index.htm;
    try_files $uri $uri/ /index.html;

    #error_page  404              /404.html;

    # redirect server error pages to the static page /50x.html
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;


I’ve no clue how to configure saml on that. Any ideas?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

You could try using SSO with Nginx auth_request module, it is quite well described here: