Skip to content

Instantly share code, notes, and snippets.

Last active May 3, 2016
What would you like to do?
Koel config for Nginx (Tuto :
server {
listen 80;
server_name koel.ndd.tld;
return 301 https://koel.ndd.tld$request_uri;
server {
listen 443 ssl http2;
# Without HTTP2
#listen 443 ssl;
server_name koel.ndd.tld;
root /var/www/koel;
index index.php;
ssl_certificate /etc/letsencrypt/live/koel.ndd.tld/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/koel.ndd.tld/privkey.pem;
# Deny access to dotfiles
location ~ /\. {
deny all;
# Deny access to framework directories
location ~ /(app|bootstrap|config|database|resources|storage|tests|vendor|node_modules)/ {
deny all;
location /media/ {
# A 'X-Media-Root' should be set to media_path settings from upstream
alias $upstream_http_x_media_root;
#access_log /var/log/nginx/koel.access.log;
#error_log /var/log/nginx/koel.error.log;
location / {
try_files $uri $uri/ /index.php?$args;
location ~ \.php$ {
try_files $uri $uri/ /index.php?$args;
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;
# PHP7
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
# PHP5
#fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_intercept_errors on;
include fastcgi_params;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment