Skip to content

Instantly share code, notes, and snippets.

@flatanimals
Created January 13, 2015 14:56
Show Gist options
  • Save flatanimals/c1ffc8e56ec21c5f0489 to your computer and use it in GitHub Desktop.
Save flatanimals/c1ffc8e56ec21c5f0489 to your computer and use it in GitHub Desktop.
Nginx server config for Laravel 4 and SimpleSamlphp
#
# Nginx host conf
#
# Allows Laravel 4 and SimpleSamlphp to exist together peacefully
#
# Laravel 4 -
# https://github.com/laravel/laravel
# SimpleSamlphp -
# https://github.com/simplesamlphp/simplesamlphp
#
server {
listen 80;
listen [::]:80 ipv6only=on;
# listen 443 ssl;
server_name your.domain.name;
# ssl info
# ssl_certificate /etc/nginx/ssl/your.domain.name.crt;
# ssl_certificate_key /etc/nginx/ssl/your.domain.name.key;
# site root path
root /var/www/public;
# simple saml config block
location /simplesaml {
# add alias root to global simple saml install (default location)
alias /var/simplesamlphp/www;
# set index document
index index.php;
# simple saml php-fpm config
# based on: http://casadelkrogh.dk/code/2014/09/30/embedding-simplesamlphp-using-nginx/
location ~ \.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
# laravel url config
location / {
index index.php;
try_files $uri $uri/ /index.php?q=$uri&$args;
}
# laravel php config
# based on : http://laravel-recipes.com/recipes/26/creating-a-nginx-virtualhost
location ~ \.php$ {
fastcgi_split_path_info ^(.+?\.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment