Skip to content

Instantly share code, notes, and snippets.

@dangtrinhnt
Created April 2, 2014 09:12
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dangtrinhnt/9930648 to your computer and use it in GitHub Desktop.
Save dangtrinhnt/9930648 to your computer and use it in GitHub Desktop.
nginx configuration for simplesamlphp
server {
listen 80;
root /var/www/simplesamlphp/www;
index index.php index.html index.htm;
server_name localhost;
ssl on;
ssl_certificate /etc/simplesamlphp_cert/simplesamlphp.crt;
ssl_certificate_key /etc/simplesamlphp_cert/simplesamlphp.key;
ssl_session_timeout 5m;
ssl_protocols SSLv3 TLSv1;
ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv3:+EXP;
ssl_prefer_server_ciphers on;
location / {
try_files $uri $uri/ /index.php?args;
#try_files $uri $uri/ /index.html;
}
location /simplesaml {
alias /var/www/simplesamlphp/www;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_read_timeout 300;
}
}
@asasmoyo
Copy link

hai, did you success install simplesamlphp on nginx?
i got redirect loop when i install simplesamlphp on nginx.

@YarGnawh
Copy link

YarGnawh commented Dec 1, 2014

@asasmoyo take a look at this thread https://groups.google.com/d/msg/simplesamlphp/TvU1qZpWBIs/N6KBsGc-aqgJ

also, the redirect loop could be caused by php session not being set. Write a simple page to test php session.

@CostanzoPablo
Copy link

CostanzoPablo commented Feb 19, 2018

ln -s /var/simplesamlphp/www /var/simplesamlphp/www/simplesaml

#/etc/nginx/sites-available/saml

server {
listen 80;

root /var/simplesamlphp/www;
index index.php index.html index.htm index.nginx-debian.html;

server_name saml.vu;

location / {
    try_files $uri $uri/ /index.php?args;
}

location ~ \.php$ {
    include snippets/fastcgi-php.conf;
    fastcgi_pass 127.0.0.1:9000;
}

location ~ /\.ht {
    deny all;
}

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment