Nginx, Ampache

Il file di configurazione per "ampache": /etc/nginx/ampache.conf

 

location /ampache {
  try_files $uri $uri/ /index.php;
  #index index.php;

  # Rewrite rule for Subsonic backend
  if ( !-d $request_filename ) {
    rewrite ^/rest/(.*).view$ /rest/index.php?action=$1 last;
    rewrite ^/rest/fake/(.+)$ /play/$1 last;
  }

  # Rewrite rule for Plex backend
  if ( !-d $request_filename ) {
    rewrite ^/plex/(.*)$ /plex/index.php?action=$1 last;
  }

  # Rewrite rule for Channels
  if (!-d $request_filename){
    rewrite ^/channel/([0-9]+)/(.*)$ /channel/index.php?channel=$1&target=$2 last;
  }

  # Beautiful URL Rewriting
  rewrite ^/play/ssid/(\w+)/type/(\w+)/oid/([0-9]+)/uid/([0-9]+)/name/(.*)$ /play/index.php?ssid=$1&type=$2&oid=$3&uid=$4&name=$5 last;
  rewrite ^/play/ssid/(\w+)/type/(\w+)/oid/([0-9]+)/uid/([0-9]+)/client/(.*)/noscrobble/([0-1])/name/(.*)$ /play/index.php?ssid=$1&type=$2&oid=$3&uid=$4&client=$5&noscrobble=$6&name=$7 last;
  location /ampache/play {
    if (!-e $request_filename) {
      rewrite ^/play/art/([^/]+)/([^/]+)/([0-9]+)/thumb([0-9]*)\.([a-z]+)$ /image.php?object_type=$2&object_id=$3&auth=$1;
      break;
    }

    rewrite ^/([^/]+)/([^/]+)(/.*)?$ /play/$3?$1=$2;
    rewrite ^/(/[^/]+|[^/]+/|/?)$ /play/index.php last;
    break;
  }

  location /ampache/rest {
    limit_except GET POST {
      deny all;
    }
  }

  location /ampache/plex {
    limit_except GET POST {
      deny all;
    }
  }

  location ^~ /ampache/bin/ {
    deny all;
    return 403;
  }