-2

I have an nginx vhost miss configuration. Whenever I visit my hosted ampache url I get a blank page. No error is logged either on ampache log, nginx log or php-fpm log. Access is being logged on ampache access log and php-fpm log with status 200. Heres my nginx vhost config:

server {
  listen 80;
  server_name ampache.mydomain.com;
  root /var/www/ampache.mydomain.com/htdocs/ampache/;

  access_log  /var/log/nginx/ampache.access.log;
  error_log   /var/log/nginx/ampache.error.log;
  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;

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

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

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

  location ^~ /config/ {
    deny all;
    return 403;
  }

  location / {
    limit_except GET POST HEAD{
      deny all;
    }
  }

  location ~ ^/.*.php {
    # try_files $uri = 404;
    # try_files $1 = 404;
    fastcgi_index index.php;
    include fastcgi_params;
    # fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    # fastcgi_param PATH_INFO $2;
    # fastcgi_param HTTPS on;
    fastcgi_split_path_info ^(.+?\.php)(/.*)$;
    fastcgi_pass unix:/run/php-fpm.socket;
  }

  # Rewrite rule for WebSocket
  location /ws {
    rewrite ^/ws/(.*) /$1 break;
    # proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header Host $host;
    proxy_pass http://127.0.0.1:8100/;
  }
}

1 Answer 1

0

I could fix my miss configuration like this

...
location ~ \.php$ {
  try_files  $uri =404;
  fastcgi_pass unix:/run/php-fpm.socket;
  fastcgi_index  index.php;
  fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
  include        fastcgi_params;
 }
 ...

Not the answer you're looking for? Browse other questions tagged .